fetches(null, [1000 => ['name' => 'testgroup']]) ->fetches(1000, []); $this->withoutExceptionHandling()->login()->loginNami(); (new InitializeGroups(app(NamiSettings::class)->login()))->handle(); $this->assertDatabaseHas('groups', ['nami_id' => 1000, 'name' => 'testgroup']); } public function testItInitializesSubgroups(): void { app(GroupFake::class) ->fetches(null, [1000 => ['name' => 'testgroup']]) ->fetches(1000, [ 1001 => ['name' => 'subgroup1'], 1002 => ['name' => 'subgroup2'], ]) ->fetches(1001, []) ->fetches(1002, []); $this->withoutExceptionHandling()->login()->loginNami(); (new InitializeGroups(app(NamiSettings::class)->login()))->handle(); $this->assertDatabaseHas('groups', ['nami_id' => 1000, 'name' => 'testgroup']); $this->assertDatabaseHas('groups', ['nami_id' => 1001, 'name' => 'subgroup1']); $this->assertDatabaseHas('groups', ['nami_id' => 1002, 'name' => 'subgroup2']); } }