| @@ 81-98 (lines=18) @@ | ||
| 78 | /** |
|
| 79 | * @test |
|
| 80 | */ |
|
| 81 | public function seedCollectionContainsTwoGroups() |
|
| 82 | { |
|
| 83 | /** @var User $userSeed */ |
|
| 84 | $userSeed = GeneralUtility::makeInstance(User::class); |
|
| 85 | $userSeed->run(); |
|
| 86 | $seedCollection = GeneralUtility::makeInstance(SeedCollection::class); |
|
| 87 | ||
| 88 | $groups = []; |
|
| 89 | foreach ($seedCollection->toArray()['fe_groups'] as $key => $group) { |
|
| 90 | if ($group['title'] === 'Group') { |
|
| 91 | $groups[$key] = $group; |
|
| 92 | } |
|
| 93 | } |
|
| 94 | $this->assertSame([ |
|
| 95 | 0 => 'NEW3', |
|
| 96 | 1 => 'NEW4', |
|
| 97 | ], array_keys($groups)); |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * @test |
|
| @@ 103-120 (lines=18) @@ | ||
| 100 | /** |
|
| 101 | * @test |
|
| 102 | */ |
|
| 103 | public function seedCollectionContainsTwoSubGroups() |
|
| 104 | { |
|
| 105 | /** @var User $userSeed */ |
|
| 106 | $userSeed = GeneralUtility::makeInstance(User::class); |
|
| 107 | $userSeed->run(); |
|
| 108 | $seedCollection = GeneralUtility::makeInstance(SeedCollection::class); |
|
| 109 | ||
| 110 | $groups = []; |
|
| 111 | foreach ($seedCollection->toArray()['fe_groups'] as $key => $group) { |
|
| 112 | if ($group['title'] === 'SubGroup') { |
|
| 113 | $groups[$key] = $group; |
|
| 114 | } |
|
| 115 | } |
|
| 116 | $this->assertSame([ |
|
| 117 | 0 => 'NEW5', |
|
| 118 | 1 => 'NEW6', |
|
| 119 | ], array_keys($groups)); |
|
| 120 | } |
|
| 121 | ||
| 122 | /** |
|
| 123 | * @test |
|
| @@ 125-140 (lines=16) @@ | ||
| 122 | /** |
|
| 123 | * @test |
|
| 124 | */ |
|
| 125 | public function userHasRelationToTwoGroups() |
|
| 126 | { |
|
| 127 | /** @var User $userSeed */ |
|
| 128 | $userSeed = GeneralUtility::makeInstance(User::class); |
|
| 129 | $userSeed->run(); |
|
| 130 | $seedCollection = GeneralUtility::makeInstance(SeedCollection::class); |
|
| 131 | ||
| 132 | $users = []; |
|
| 133 | foreach ($seedCollection->toArray()['fe_users'] as $key => $user) { |
|
| 134 | $users[$key] = $user['usergroup']; |
|
| 135 | } |
|
| 136 | $this->assertSame([ |
|
| 137 | 0 => 'NEW3,NEW4', |
|
| 138 | 1 => 'NEW3,NEW4', |
|
| 139 | ], array_values($users)); |
|
| 140 | } |
|
| 141 | ||
| 142 | /** |
|
| 143 | * When the seeder has empty values it can cause errors when inserting data |
|