fixed initialize members
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
211f93ec17
commit
2a49f83014
|
@ -3,15 +3,12 @@
|
||||||
namespace Tests\Feature\Initialize;
|
namespace Tests\Feature\Initialize;
|
||||||
|
|
||||||
use App\Initialize\InitializeMembers;
|
use App\Initialize\InitializeMembers;
|
||||||
use App\Member\Member;
|
use App\Nami\Api\FullMemberAction;
|
||||||
use App\Nami\Api\CoursesOfAction;
|
|
||||||
use App\Nami\Api\MembershipsOfAction;
|
|
||||||
use App\Setting\NamiSettings;
|
use App\Setting\NamiSettings;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
use Zoomyboy\LaravelNami\Data\MemberEntry;
|
use Zoomyboy\LaravelNami\Data\MemberEntry;
|
||||||
use Zoomyboy\LaravelNami\Fakes\MemberFake;
|
|
||||||
use Zoomyboy\LaravelNami\Fakes\SearchFake;
|
use Zoomyboy\LaravelNami\Fakes\SearchFake;
|
||||||
|
|
||||||
class InitializeMembersTest extends TestCase
|
class InitializeMembersTest extends TestCase
|
||||||
|
@ -21,14 +18,11 @@ class InitializeMembersTest extends TestCase
|
||||||
public function testItInitializesMembers(): void
|
public function testItInitializesMembers(): void
|
||||||
{
|
{
|
||||||
$this->loginNami();
|
$this->loginNami();
|
||||||
$member = Member::factory()->defaults()->create();
|
|
||||||
$api = app(NamiSettings::class)->login();
|
$api = app(NamiSettings::class)->login();
|
||||||
app(SearchFake::class)->fetches(1, 0, [
|
app(SearchFake::class)->fetches(1, 0, [
|
||||||
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]),
|
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]),
|
||||||
]);
|
]);
|
||||||
app(MemberFake::class)->shows(100, 20);
|
FullMemberAction::shouldRun()->once();
|
||||||
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);
|
app(InitializeMembers::class)->handle($api);
|
||||||
}
|
}
|
||||||
|
@ -36,14 +30,10 @@ class InitializeMembersTest extends TestCase
|
||||||
public function testFetchesMembersViaCommandLine(): void
|
public function testFetchesMembersViaCommandLine(): void
|
||||||
{
|
{
|
||||||
$this->loginNami();
|
$this->loginNami();
|
||||||
$api = app(NamiSettings::class)->login();
|
|
||||||
|
|
||||||
app(SearchFake::class)->fetches(1, 0, [
|
app(SearchFake::class)->fetches(1, 0, [
|
||||||
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]),
|
MemberEntry::factory()->toMember(['groupId' => 100, 'id' => 20]),
|
||||||
]);
|
]);
|
||||||
app(MemberFake::class)->shows(100, 20);
|
FullMemberAction::shouldRun()->once();
|
||||||
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');
|
Artisan::call('member:pull');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue