Fix tests
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
4d74e53fc2
commit
aaa236fcd5
|
@ -5,7 +5,6 @@ namespace App\Member\Data;
|
||||||
use App\Group;
|
use App\Group;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Spatie\LaravelData\Data;
|
use Spatie\LaravelData\Data;
|
||||||
use Spatie\LaravelData\DataCollection;
|
|
||||||
|
|
||||||
class NestedGroup extends Data
|
class NestedGroup extends Data
|
||||||
{
|
{
|
||||||
|
@ -23,7 +22,7 @@ class NestedGroup extends Data
|
||||||
$groups = collect([]);
|
$groups = collect([]);
|
||||||
|
|
||||||
foreach (Group::where('parent_id', $parentId)->orderBy('name')->get()->toBase() as $group) {
|
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));
|
$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
|
|
@ -55,7 +55,7 @@ class InitializeActivitiesTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function activityDataProvider(): Generator
|
public static function activityDataProvider(): Generator
|
||||||
{
|
{
|
||||||
yield [
|
yield [
|
||||||
fn (ActivityFake $fake) => $fake->fetches(1000, [
|
fn (ActivityFake $fake) => $fake->fetches(1000, [
|
||||||
|
|
|
@ -109,7 +109,7 @@ class PreventionTest extends TestCase
|
||||||
$this->assertNotNull($participant->fresh()->last_remembered_at);
|
$this->assertNotNull($participant->fresh()->last_remembered_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function attributes(): Generator
|
public static function attributes(): Generator
|
||||||
{
|
{
|
||||||
yield [
|
yield [
|
||||||
'attrs' => ['has_vk' => true, 'efz' => null, 'ps_at' => now()],
|
'attrs' => ['has_vk' => true, 'efz' => null, 'ps_at' => now()],
|
||||||
|
@ -172,12 +172,12 @@ class PreventionTest extends TestCase
|
||||||
* @param array<string, mixed> $memberAttributes
|
* @param array<string, mixed> $memberAttributes
|
||||||
*/
|
*/
|
||||||
#[DataProvider('attributes')]
|
#[DataProvider('attributes')]
|
||||||
public function testItRemembersMember(array $memberAttributes, array $preventions): void
|
public function testItRemembersMember(array $attrs, array $preventions): void
|
||||||
{
|
{
|
||||||
Mail::fake();
|
Mail::fake();
|
||||||
$form = $this->createForm();
|
$form = $this->createForm();
|
||||||
$participant = $this->createParticipant($form);
|
$participant = $this->createParticipant($form);
|
||||||
$participant->member->update($memberAttributes);
|
$participant->member->update($attrs);
|
||||||
|
|
||||||
PreventionRememberAction::run();
|
PreventionRememberAction::run();
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ class ShowTest extends TestCase
|
||||||
], $response, 'data');
|
], $response, 'data');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function membershipDataProvider(): Generator
|
public static function membershipDataProvider(): Generator
|
||||||
{
|
{
|
||||||
yield [now()->subMonths(2), null, true];
|
yield [now()->subMonths(2), null, true];
|
||||||
yield [now()->subMonths(2), now()->subDay(), false];
|
yield [now()->subMonths(2), now()->subDay(), false];
|
||||||
|
|
|
@ -46,7 +46,7 @@ class IndexTest extends TestCase
|
||||||
->assertJsonPath('meta.links.store', route('member.membership.store', ['member' => $member]));
|
->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), null, true];
|
||||||
yield [now()->subMonths(2), now()->subDay(), false];
|
yield [now()->subMonths(2), now()->subDay(), false];
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ServiceTest extends TestCase
|
||||||
]), 200),
|
]), 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(994, $result->memberId);
|
||||||
$this->assertEquals('test@example.com', $result->email);
|
$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),
|
'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
|
public function testItCanGetLists(): void
|
||||||
|
@ -90,7 +90,7 @@ class ServiceTest extends TestCase
|
||||||
$this->assertEquals('Eltern', $lists[0]->displayName);
|
$this->assertEquals('Eltern', $lists[0]->displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listDataProvider(): Generator
|
public static function listDataProvider(): Generator
|
||||||
{
|
{
|
||||||
foreach (range(3, 40) as $i) {
|
foreach (range(3, 40) as $i) {
|
||||||
yield [
|
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());
|
$this->assertCount($totals->count(), $result->toArray());
|
||||||
Http::assertSentCount($totals->chunk(10)->count());
|
Http::assertSentCount($totals->chunk(10)->count());
|
||||||
|
|
Loading…
Reference in New Issue