Code Duplication    Length = 42-42 lines in 2 locations

Tests/Units/ListTestCase.php 1 location

@@ 200-241 (lines=42) @@
197
    /**
198
     * Test findOne.
199
     */
200
    public function testFindOne()
201
    {
202
        $this
203
            ->given(
204
                $unique = $this->uniqueValue(),
205
                $criteria = Criteria::eq($unique),
206
                $emptyCollection = $this->emptyCollection()
207
            )
208
            ->when($findResult = $emptyCollection->findOne($criteria))
209
            ->then()
210
                ->variable($findResult)
211
                    ->isNull()
212
            ->and()
213
            ->when(
214
                $emptyCollection->add($unique),
215
                $findResult = $emptyCollection->findOne($criteria)
216
            )
217
            ->then()
218
                ->variable($findResult)
219
                    ->isEqualTo($unique)
220
        ;
221
222
        $this
223
            ->given(
224
                $unique = $this->uniqueValue(),
225
                $criteria = Criteria::eq($unique),
226
                $randomCollection = $this->randomCollection()
227
            )
228
            ->when($findResult = $randomCollection->findOne($criteria))
229
            ->then()
230
                ->variable($findResult)
231
                    ->isNull()
232
            ->and()
233
            ->when(
234
                $randomCollection->add($unique),
235
                $findResult = $randomCollection->findOne($criteria)
236
            )
237
            ->then()
238
                ->variable($findResult)
239
                    ->isEqualTo($unique)
240
        ;
241
    }
242
}
243

Tests/Units/SetTestCase.php 1 location

@@ 218-259 (lines=42) @@
215
    /**
216
     * Test findOne.
217
     */
218
    public function testFindOne()
219
    {
220
        $this
221
            ->given(
222
                $unique = $this->uniqueValue(),
223
                $criteria = Criteria::eq($unique),
224
                $emptyCollection = $this->emptyCollection()
225
            )
226
            ->when($findResult = $emptyCollection->findOne($criteria))
227
            ->then()
228
                ->variable($findResult)
229
                    ->isNull()
230
            ->and()
231
            ->when(
232
                $emptyCollection->add($unique),
233
                $findResult = $emptyCollection->findOne($criteria)
234
            )
235
            ->then()
236
                ->variable($findResult)
237
                    ->isEqualTo($unique)
238
        ;
239
240
        $this
241
            ->given(
242
                $unique = $this->uniqueValue(),
243
                $criteria = Criteria::eq($unique),
244
                $randomCollection = $this->randomCollection()
245
            )
246
            ->when($findResult = $randomCollection->findOne($criteria))
247
            ->then()
248
                ->variable($findResult)
249
                    ->isNull()
250
            ->and()
251
            ->when(
252
                $randomCollection->add($unique),
253
                $findResult = $randomCollection->findOne($criteria)
254
            )
255
            ->then()
256
                ->variable($findResult)
257
                    ->isEqualTo($unique)
258
        ;
259
    }
260
}
261