Fixed tests
This commit is contained in:
parent
4a4f2aa8d1
commit
d11c99dbcf
|
@ -74,7 +74,7 @@ class MemberRequest extends FormRequest
|
|||
'letter_address' => '',
|
||||
'gender_id' => 'nullable|exists:genders,id',
|
||||
'region_id' => 'nullable|exists:regions,id',
|
||||
'nationality_id' => 'nullable|exists:nationalities,id',
|
||||
'nationality_id' => 'required|exists:nationalities,id',
|
||||
'children_phone' => '',
|
||||
'fax' => '',
|
||||
'other_country' => '',
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"cviebrock/eloquent-sluggable": "^9.0",
|
||||
"doctrine/dbal": "^3.1",
|
||||
"guzzlehttp/guzzle": "^7.0.1",
|
||||
"inertiajs/inertia-laravel": "^0.5.4",
|
||||
"inertiajs/inertia-laravel": "^0.2.5",
|
||||
"laravel/framework": "^9.0",
|
||||
"laravel/horizon": "^5.0",
|
||||
"laravel/telescope": "^4.13",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "85d216d735a37230867f8b4f8c5cd639",
|
||||
"content-hash": "3f92cd2d13ef34d0928579c8f1ea9df9",
|
||||
"packages": [
|
||||
{
|
||||
"name": "amphp/amp",
|
||||
|
@ -2225,28 +2225,20 @@
|
|||
},
|
||||
{
|
||||
"name": "inertiajs/inertia-laravel",
|
||||
"version": "v0.5.4",
|
||||
"version": "v0.2.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/inertiajs/inertia-laravel.git",
|
||||
"reference": "6a050ce04a710ac4809161558ac09fe49f13075e"
|
||||
"reference": "ef618736fb566e5c85d862fa0cf6061422f19046"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/6a050ce04a710ac4809161558ac09fe49f13075e",
|
||||
"reference": "6a050ce04a710ac4809161558ac09fe49f13075e",
|
||||
"url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/ef618736fb566e5c85d862fa0cf6061422f19046",
|
||||
"reference": "ef618736fb566e5c85d862fa0cf6061422f19046",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"laravel/framework": "^6.0|^7.0|^8.74|^9.0",
|
||||
"php": "^7.2|~8.0.0|~8.1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "^1.3.3",
|
||||
"orchestra/testbench": "^4.0|^5.0|^6.4|^7.0",
|
||||
"phpunit/phpunit": "^8.0|^9.5.8",
|
||||
"roave/security-advisories": "dev-master"
|
||||
"orchestra/testbench": "~3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
@ -2282,15 +2274,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/inertiajs/inertia-laravel/issues",
|
||||
"source": "https://github.com/inertiajs/inertia-laravel/tree/v0.5.4"
|
||||
"source": "https://github.com/inertiajs/inertia-laravel/tree/master"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/reinink",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-01-18T10:59:08+00:00"
|
||||
"time": "2020-02-28T14:50:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "intervention/image",
|
||||
|
@ -3190,16 +3176,16 @@
|
|||
},
|
||||
{
|
||||
"name": "league/glide",
|
||||
"version": "2.2.2",
|
||||
"version": "2.2.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/glide.git",
|
||||
"reference": "bff5b0fe2fd26b2fde2d6958715fde313887d79d"
|
||||
"reference": "446b1fc9f15101db52e8ddb7bec8cb16e814b244"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/glide/zipball/bff5b0fe2fd26b2fde2d6958715fde313887d79d",
|
||||
"reference": "bff5b0fe2fd26b2fde2d6958715fde313887d79d",
|
||||
"url": "https://api.github.com/repos/thephpleague/glide/zipball/446b1fc9f15101db52e8ddb7bec8cb16e814b244",
|
||||
"reference": "446b1fc9f15101db52e8ddb7bec8cb16e814b244",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -3249,9 +3235,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/thephpleague/glide/issues",
|
||||
"source": "https://github.com/thephpleague/glide/tree/2.2.2"
|
||||
"source": "https://github.com/thephpleague/glide/tree/2.2.3"
|
||||
},
|
||||
"time": "2022-02-21T07:40:55+00:00"
|
||||
"time": "2023-02-14T06:15:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/mime-type-detection",
|
||||
|
@ -13344,7 +13330,14 @@
|
|||
"time": "2023-01-11T23:22:44+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"aliases": [
|
||||
{
|
||||
"package": "zoomyboy/tex",
|
||||
"version": "dev-main",
|
||||
"alias": "1.0",
|
||||
"alias_normalized": "1.0.0.0"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": {
|
||||
"zoomyboy/laravel-nami": 20,
|
||||
|
|
|
@ -1814,9 +1814,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@inertiajs/inertia": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@inertiajs/inertia/-/inertia-0.11.0.tgz",
|
||||
"integrity": "sha512-QF4hctgFC+B/t/WClCwfOla+WoDE9iTltQJ0u+DCfjl0KdGoCvIxYiNtuH8h8oM+RQMb8orjbpW3pHapjYI5Vw==",
|
||||
"version": "0.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@inertiajs/inertia/-/inertia-0.11.1.tgz",
|
||||
"integrity": "sha512-btmV53c54oW4Z9XF0YyTdIUnM7ue0ONy3/KJOz6J1C5CYIwimiKfDMpz8ZbGJuxS+SPdOlNsqj2ZhlHslpJRZg==",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"deepmerge": "^4.0.0",
|
||||
|
@ -6814,7 +6814,7 @@
|
|||
"node_modules/lodash.isequal": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
|
||||
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="
|
||||
},
|
||||
"node_modules/lodash.memoize": {
|
||||
"version": "4.1.2",
|
||||
|
@ -12163,9 +12163,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@inertiajs/inertia": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@inertiajs/inertia/-/inertia-0.11.0.tgz",
|
||||
"integrity": "sha512-QF4hctgFC+B/t/WClCwfOla+WoDE9iTltQJ0u+DCfjl0KdGoCvIxYiNtuH8h8oM+RQMb8orjbpW3pHapjYI5Vw==",
|
||||
"version": "0.11.1",
|
||||
"resolved": "https://registry.npmjs.org/@inertiajs/inertia/-/inertia-0.11.1.tgz",
|
||||
"integrity": "sha512-btmV53c54oW4Z9XF0YyTdIUnM7ue0ONy3/KJOz6J1C5CYIwimiKfDMpz8ZbGJuxS+SPdOlNsqj2ZhlHslpJRZg==",
|
||||
"requires": {
|
||||
"axios": "^0.21.1",
|
||||
"deepmerge": "^4.0.0",
|
||||
|
@ -16039,7 +16039,7 @@
|
|||
"lodash.isequal": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz",
|
||||
"integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
|
||||
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ=="
|
||||
},
|
||||
"lodash.memoize": {
|
||||
"version": "4.1.2",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d48383ded42851e9f7231b49142ac31c12b8238b
|
||||
Subproject commit 07d1e67698ef09fe274a35f3d822ef3dd526ff22
|
|
@ -2,17 +2,16 @@
|
|||
|
||||
namespace Tests\Feature\Initialize;
|
||||
|
||||
use App\Actions\PullCoursesAction;
|
||||
use App\Actions\PullMemberAction;
|
||||
use App\Actions\PullMembershipsAction;
|
||||
use App\Initialize\InitializeMembers;
|
||||
use App\Member\Member;
|
||||
use App\Nami\Api\CoursesOfAction;
|
||||
use App\Nami\Api\MembershipsOfAction;
|
||||
use App\Setting\NamiSettings;
|
||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
use Tests\TestCase;
|
||||
use Zoomyboy\LaravelNami\Data\MemberEntry;
|
||||
use Zoomyboy\LaravelNami\Exceptions\MemberDataCorruptedException;
|
||||
use Zoomyboy\LaravelNami\Fakes\MemberFake;
|
||||
use Zoomyboy\LaravelNami\Fakes\SearchFake;
|
||||
|
||||
class InitializeMembersTest extends TestCase
|
||||
|
@ -27,25 +26,9 @@ class InitializeMembersTest extends TestCase
|
|||
app(SearchFake::class)->fetches(1, 0, [
|
||||
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]),
|
||||
]);
|
||||
PullMemberAction::shouldRun()->once()->with(100, 20)->andReturn($member);
|
||||
PullMembershipsAction::shouldRun()->once()->with($member);
|
||||
PullCoursesAction::shouldRun()->once()->with($member);
|
||||
|
||||
app(InitializeMembers::class)->handle($api);
|
||||
}
|
||||
|
||||
public function testFetchesMembersWhenJoinedAtDateIsNull(): void
|
||||
{
|
||||
$this->loginNami();
|
||||
$api = app(NamiSettings::class)->login();
|
||||
app(SearchFake::class)->fetches(1, 0, [
|
||||
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]),
|
||||
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 21]),
|
||||
]);
|
||||
PullMemberAction::shouldRun()->once()->with(100, 20)->andThrow(MemberDataCorruptedException::class, []);
|
||||
PullMemberAction::shouldRun()->once()->with(100, 21);
|
||||
PullMembershipsAction::shouldRun()->once();
|
||||
PullCoursesAction::shouldRun()->once();
|
||||
app(MemberFake::class)->shows(100, 20);
|
||||
MembershipsOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([]));
|
||||
CoursesOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([]));
|
||||
|
||||
app(InitializeMembers::class)->handle($api);
|
||||
}
|
||||
|
@ -58,9 +41,9 @@ class InitializeMembersTest extends TestCase
|
|||
app(SearchFake::class)->fetches(1, 0, [
|
||||
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]),
|
||||
]);
|
||||
PullMemberAction::shouldRun()->once()->with(100, 20);
|
||||
PullMembershipsAction::shouldRun()->once();
|
||||
PullCoursesAction::shouldRun()->once();
|
||||
app(MemberFake::class)->shows(100, 20);
|
||||
MembershipsOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([]));
|
||||
CoursesOfAction::shouldRun()->once()->withArgs(fn ($api, $id) => 20 === $id)->andReturn(collect([]));
|
||||
|
||||
Artisan::call('member:pull');
|
||||
}
|
||||
|
|
|
@ -114,6 +114,20 @@ class StoreTest extends TestCase
|
|||
NamiPutMemberAction::spy()->shouldNotHaveReceived('handle');
|
||||
}
|
||||
|
||||
public function testItRequiresFields(): void
|
||||
{
|
||||
Fee::factory()->create();
|
||||
$this->login()->loginNami();
|
||||
NamiPutMemberAction::allowToRun();
|
||||
|
||||
$response = $this
|
||||
->post('/member', $this->attributes([
|
||||
'nationality_id' => null,
|
||||
]));
|
||||
|
||||
$response->assertSessionHasErrors(['nationality_id']);
|
||||
}
|
||||
|
||||
public function testSubscriptionIsRequiredIfFirstActivityIsPaid(): void
|
||||
{
|
||||
$this->login()->loginNami();
|
||||
|
|
Loading…
Reference in New Issue