Code Duplication    Length = 16-21 lines in 3 locations

spec/Prophecy/Prophecy/MethodProphecySpec.php 3 locations

@@ 295-310 (lines=16) @@
292
        $this->callOnWrappedObject('shouldHave', array($prediction));
293
    }
294
295
    function it_sets_return_promise_during_shouldHave_call_if_none_was_set_before(
296
        ObjectProphecy $objectProphecy,
297
        ArgumentsWildcard $arguments,
298
        PredictionInterface $prediction,
299
        Call $call1,
300
        Call $call2
301
    ) {
302
        $objectProphecy->addMethodProphecy($this)->willReturn(null);
303
        $prediction->check(array($call1, $call2), $objectProphecy->getWrappedObject(), $this)->shouldBeCalled();
304
        $objectProphecy->findProphecyMethodCalls('getName', $arguments)->willReturn(array($call1, $call2));
305
306
        $this->withArguments($arguments);
307
        $this->callOnWrappedObject('shouldHave', array($prediction));
308
309
        $this->getPromise()->shouldReturnAnInstanceOf('Prophecy\Promise\ReturnPromise');
310
    }
311
312
    function it_does_not_set_return_promise_during_shouldHave_call_if_it_was_set_before(
313
        ObjectProphecy $objectProphecy,
@@ 312-329 (lines=18) @@
309
        $this->getPromise()->shouldReturnAnInstanceOf('Prophecy\Promise\ReturnPromise');
310
    }
311
312
    function it_does_not_set_return_promise_during_shouldHave_call_if_it_was_set_before(
313
        ObjectProphecy $objectProphecy,
314
        ArgumentsWildcard $arguments,
315
        PredictionInterface $prediction,
316
        Call $call1,
317
        Call $call2,
318
        PromiseInterface $promise
319
    ) {
320
        $objectProphecy->addMethodProphecy($this)->willReturn(null);
321
        $prediction->check(array($call1, $call2), $objectProphecy->getWrappedObject(), $this)->shouldBeCalled();
322
        $objectProphecy->findProphecyMethodCalls('getName', $arguments)->willReturn(array($call1, $call2));
323
324
        $this->will($promise);
325
        $this->withArguments($arguments);
326
        $this->callOnWrappedObject('shouldHave', array($prediction));
327
328
        $this->getPromise()->shouldReturn($promise);
329
    }
330
331
    function it_records_checked_predictions(
332
        ObjectProphecy $objectProphecy,
@@ 353-373 (lines=21) @@
350
        $this->getCheckedPredictions()->shouldReturn(array($prediction1, $prediction2));
351
    }
352
353
    function it_records_even_failed_checked_predictions(
354
        ObjectProphecy $objectProphecy,
355
        ArgumentsWildcard $arguments,
356
        PredictionInterface $prediction,
357
        Call $call1,
358
        Call $call2,
359
        PromiseInterface $promise
360
    ) {
361
        $objectProphecy->addMethodProphecy($this)->willReturn(null);
362
        $prediction->check(array($call1, $call2), $objectProphecy->getWrappedObject(), $this)->willThrow(new RuntimeException());
363
        $objectProphecy->findProphecyMethodCalls('getName', $arguments)->willReturn(array($call1, $call2));
364
365
        $this->will($promise);
366
        $this->withArguments($arguments);
367
368
        try {
369
            $this->callOnWrappedObject('shouldHave', array($prediction));
370
        } catch (\Exception $e) {}
371
372
        $this->getCheckedPredictions()->shouldReturn(array($prediction));
373
    }
374
375
    function it_checks_prediction_via_shouldHave_method_call_with_callback(
376
        ObjectProphecy $objectProphecy,