Code Duplication    Length = 16-18 lines in 4 locations

Tests/Functional/Seeder/ImageTest.php 1 location

@@ 65-80 (lines=16) @@
62
    /**
63
     * @test
64
     */
65
    public function eachPageShouldHaveOneImage()
66
    {
67
        /** @var Pages $pagesSeed */
68
        $pagesSeed = GeneralUtility::makeInstance(Pages::class);
69
        $pagesSeed->run();
70
        $seedCollection = GeneralUtility::makeInstance(SeedCollection::class);
71
72
        $pages = [];
73
        foreach ($seedCollection->toArray()['pages'] as $key => $user) {
74
            $pages[$key] = $user['media'];
75
        }
76
        $this->assertSame([
77
            0 => 'NEW3',
78
            1 => 'NEW4',
79
        ], array_values($pages));
80
    }
81
82
    public function tearDown()
83
    {

Tests/Functional/Seeder/RelationTest.php 3 locations

@@ 82-99 (lines=18) @@
79
    /**
80
     * @test
81
     */
82
    public function seedCollectionContainsTwoGroups()
83
    {
84
        /** @var User $userSeed */
85
        $userSeed = GeneralUtility::makeInstance(User::class);
86
        $userSeed->run();
87
        $seedCollection = GeneralUtility::makeInstance(SeedCollection::class);
88
89
        $groups = [];
90
        foreach ($seedCollection->toArray()['fe_groups'] as $key => $group) {
91
            if ($group['title'] === 'Group') {
92
                $groups[$key] = $group;
93
            }
94
        }
95
        $this->assertSame([
96
            0 => 'NEW3',
97
            1 => 'NEW4',
98
        ], array_keys($groups));
99
    }
100
101
    /**
102
     * @test
@@ 128-143 (lines=16) @@
125
    /**
126
     * @test
127
     */
128
    public function userHasRelationToTwoGroups()
129
    {
130
        /** @var User $userSeed */
131
        $userSeed = GeneralUtility::makeInstance(User::class);
132
        $userSeed->run();
133
        $seedCollection = GeneralUtility::makeInstance(SeedCollection::class);
134
135
        $users = [];
136
        foreach ($seedCollection->toArray()['fe_users'] as $key => $user) {
137
            $users[$key] = $user['usergroup'];
138
        }
139
        $this->assertSame([
140
            0 => 'NEW3,NEW4',
141
            1 => 'NEW3,NEW4',
142
        ], array_values($users));
143
    }
144
145
    /**
146
     * @test
@@ 173-190 (lines=18) @@
170
     * @test
171
     * @group failing
172
     */
173
    public function eachGroupHasTwoDifferentSubGroups()
174
    {
175
        /** @var User $userSeed */
176
        $userSeed = GeneralUtility::makeInstance(User::class);
177
        $userSeed->run();
178
        $seedCollection = GeneralUtility::makeInstance(SeedCollection::class);
179
180
        $groups = [];
181
        foreach ($seedCollection->toArray()['fe_groups'] as $key => $group) {
182
            if ($group['title'] === 'Group') {
183
                $groups[$key] = $group['subgroup'];
184
            }
185
        }
186
        $this->assertSame([
187
            'NEW3' => 'NEW5,NEW6',
188
            'NEW4' => 'NEW7,NEW8',
189
        ], $groups);
190
    }
191
192
    /**
193
     * When the seeder has empty values it can cause errors when inserting data