Code Duplication    Length = 22-23 lines in 3 locations

Tests/Unit/Collection/SeedCollectionTest.php 3 locations

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