Fix tests
continuous-integration/drone/push Build is failing Details

This commit is contained in:
philipp lang 2024-09-22 01:41:56 +02:00
parent 4d74e53fc2
commit aaa236fcd5
7 changed files with 15 additions and 16 deletions

View File

@ -5,7 +5,6 @@ namespace App\Member\Data;
use App\Group;
use Illuminate\Support\Collection;
use Spatie\LaravelData\Data;
use Spatie\LaravelData\DataCollection;
class NestedGroup extends Data
{
@ -23,7 +22,7 @@ class NestedGroup extends Data
$groups = collect([]);
foreach (Group::where('parent_id', $parentId)->orderBy('name')->get()->toBase() as $group) {
$groups->push(['name' => str_repeat('- ', $level).$group->name, 'id' => $group->id]);
$groups->push(['name' => str_repeat('- ', $level) . $group->name, 'id' => $group->id]);
$groups = $groups->merge(static::forSelect($group->id, $level + 1));
}
@ -31,10 +30,10 @@ class NestedGroup extends Data
}
/**
* @return DataCollection<int, static>
* @return Collection<int, static>
*/
public static function cacheForSelect(): DataCollection
public static function cacheForSelect(): Collection
{
return static::collection(static::forSelect());
return static::collect(static::forSelect());
}
}

@ -1 +1 @@
Subproject commit b735186c2d4f844f67992f86f460d6c3deaf5f28
Subproject commit 565cf2b158dc60283f3ca1daadd7b9317281d8be

View File

@ -55,7 +55,7 @@ class InitializeActivitiesTest extends TestCase
]);
}
public function activityDataProvider(): Generator
public static function activityDataProvider(): Generator
{
yield [
fn (ActivityFake $fake) => $fake->fetches(1000, [

View File

@ -109,7 +109,7 @@ class PreventionTest extends TestCase
$this->assertNotNull($participant->fresh()->last_remembered_at);
}
protected function attributes(): Generator
public static function attributes(): Generator
{
yield [
'attrs' => ['has_vk' => true, 'efz' => null, 'ps_at' => now()],
@ -172,12 +172,12 @@ class PreventionTest extends TestCase
* @param array<string, mixed> $memberAttributes
*/
#[DataProvider('attributes')]
public function testItRemembersMember(array $memberAttributes, array $preventions): void
public function testItRemembersMember(array $attrs, array $preventions): void
{
Mail::fake();
$form = $this->createForm();
$participant = $this->createParticipant($form);
$participant->member->update($memberAttributes);
$participant->member->update($attrs);
PreventionRememberAction::run();

View File

@ -171,7 +171,7 @@ class ShowTest extends TestCase
], $response, 'data');
}
public function membershipDataProvider(): Generator
public static function membershipDataProvider(): Generator
{
yield [now()->subMonths(2), null, true];
yield [now()->subMonths(2), now()->subDay(), false];

View File

@ -46,7 +46,7 @@ class IndexTest extends TestCase
->assertJsonPath('meta.links.store', route('member.membership.store', ['member' => $member]));
}
public function membershipDataProvider(): Generator
public static function membershipDataProvider(): Generator
{
yield [now()->subMonths(2), null, true];
yield [now()->subMonths(2), now()->subDay(), false];

View File

@ -52,7 +52,7 @@ class ServiceTest extends TestCase
]), 200),
]);
$result = app(MailmanService::class)->setCredentials('http://mailman.test/api/', 'user', 'secret')->members(MailingList::factory()->id('listid')->toData())->first();
$result = app(MailmanService::class)->setCredentials('http://mailman.test/api/', 'user', 'secret')->members(MailingList::toFactory()->id('listid')->toData())->first();
$this->assertEquals(994, $result->memberId);
$this->assertEquals('test@example.com', $result->email);
@ -67,7 +67,7 @@ class ServiceTest extends TestCase
'http://mailman.test/api/lists/listid/roster/member?page=1&count=10' => Http::response('', 401),
]);
app(MailmanService::class)->setCredentials('http://mailman.test/api/', 'user', 'secret')->members(MailingList::factory()->id('listid')->toData())->first();
app(MailmanService::class)->setCredentials('http://mailman.test/api/', 'user', 'secret')->members(MailingList::toFactory()->id('listid')->toData())->first();
}
public function testItCanGetLists(): void
@ -90,7 +90,7 @@ class ServiceTest extends TestCase
$this->assertEquals('Eltern', $lists[0]->displayName);
}
public function listDataProvider(): Generator
public static function listDataProvider(): Generator
{
foreach (range(3, 40) as $i) {
yield [
@ -114,7 +114,7 @@ class ServiceTest extends TestCase
]);
}
$result = app(MailmanService::class)->setCredentials('http://mailman.test/api/', 'user', 'secret')->members(MailingList::factory()->id('listid')->toData());
$result = app(MailmanService::class)->setCredentials('http://mailman.test/api/', 'user', 'secret')->members(MailingList::toFactory()->id('listid')->toData());
$this->assertCount($totals->count(), $result->toArray());
Http::assertSentCount($totals->chunk(10)->count());