Code Duplication    Length = 22-23 lines in 3 locations

Tests/Unit/Collection/SeedCollectionTest.php 3 locations

@@ 108-130 (lines=23) @@
105
     * @test
106
     * @method get
107
     */
108
    public function getReturnsArrayWithTwoKeysWhenClassNameFooBar()
109
    {
110
        $seeder = $this->getMock(\Dennis\Seeder\Seeder::class);
111
        $seeder->method('getClass')->willReturn('FooBar');
112
        $fooBarSeed = $this->mockSeed('FooBar');
113
        $fooSeed = $this->mockSeed('Foo');
114
        $barSeed = $this->mockSeed('Bar');
115
116
        // NEW1
117
        $this->subject->attach($fooBarSeed);
118
        // NEW2
119
        $this->subject->attach($fooSeed);
120
        // NEW3
121
        $this->subject->attach(clone $fooBarSeed);
122
        // NEW4
123
        $this->subject->attach($barSeed);
124
125
        $this->subject->amount = 4;
126
        $this->assertSame([
127
            0 => 'NEW1',
128
            1 => 'NEW3',
129
        ], array_keys($this->subject->get($seeder)));
130
    }
131
132
    /**
133
     * @test
@@ 136-157 (lines=22) @@
133
     * @test
134
     * @method get
135
     */
136
    public function getReturnsArrayWithOneKeyWhenClassNameFoo()
137
    {
138
        $seeder = $this->getMock(\Dennis\Seeder\Seeder::class);
139
        $seeder->method('getClass')->willReturn('Foo');
140
        $fooBarSeed = $this->mockSeed('FooBar');
141
        $fooSeed = $this->mockSeed('Foo');
142
        $barSeed = $this->mockSeed('Bar');
143
144
        // NEW1
145
        $this->subject->attach($fooBarSeed);
146
        // NEW2
147
        $this->subject->attach($fooSeed);
148
        // NEW3
149
        $this->subject->attach($fooBarSeed);
150
        // NEW4
151
        $this->subject->attach($barSeed);
152
153
        $this->subject->amount = 4;
154
        $this->assertSame([
155
            0 => 'NEW2',
156
        ], array_keys($this->subject->get($seeder)));
157
    }
158
159
    /**
160
     * @test
@@ 163-184 (lines=22) @@
160
     * @test
161
     * @method get
162
     */
163
    public function getReturnsArrayWithOneKeyWhenClassNameFooBar()
164
    {
165
        $seeder = $this->getMock(\Dennis\Seeder\Seeder::class);
166
        $seeder->method('getClass')->willReturn('FooBar');
167
        $fooBarSeed = $this->mockSeed('FooBar');
168
        $fooSeed = $this->mockSeed('Foo');
169
        $barSeed = $this->mockSeed('Bar');
170
171
        // NEW1
172
        $this->subject->attach($fooBarSeed);
173
        // NEW2
174
        $this->subject->attach($fooSeed);
175
        // NEW3
176
        $this->subject->attach($fooBarSeed);
177
        // NEW4
178
        $this->subject->attach($barSeed);
179
180
        $this->subject->amount = 4;
181
        $this->assertSame([
182
            0 => 'NEW1',
183
        ], array_keys($this->subject->get($seeder)));
184
    }
185
186
    /**
187
     * @method clear