| @@ 54-75 (lines=22) @@ | ||
| 51 | $this->checkPredictions()->shouldReturn(null); |
|
| 52 | } |
|
| 53 | ||
| 54 | function it_throws_AggregateException_if_defined_predictions_fail( |
|
| 55 | MethodProphecy $method1, |
|
| 56 | MethodProphecy $method2, |
|
| 57 | ArgumentsWildcard $arguments1, |
|
| 58 | ArgumentsWildcard $arguments2 |
|
| 59 | ) { |
|
| 60 | $method1->getMethodName()->willReturn('getName'); |
|
| 61 | $method1->getArgumentsWildcard()->willReturn($arguments1); |
|
| 62 | $method1->checkPrediction()->willReturn(null); |
|
| 63 | ||
| 64 | $method2->getMethodName()->willReturn('isSet'); |
|
| 65 | $method2->getArgumentsWildcard()->willReturn($arguments2); |
|
| 66 | $method2->checkPrediction()->willThrow( |
|
| 67 | 'Prophecy\Exception\Prediction\AggregateException' |
|
| 68 | ); |
|
| 69 | ||
| 70 | $this->prophesize()->addMethodProphecy($method1); |
|
| 71 | $this->prophesize()->addMethodProphecy($method2); |
|
| 72 | ||
| 73 | $this->shouldThrow('Prophecy\Exception\Prediction\AggregateException') |
|
| 74 | ->duringCheckPredictions(); |
|
| 75 | } |
|
| 76 | ||
| 77 | function it_exposes_doubler_through_getter($doubler) |
|
| 78 | { |
|
| @@ 219-239 (lines=21) @@ | ||
| 216 | $this->checkProphecyMethodsPredictions()->shouldReturn(null); |
|
| 217 | } |
|
| 218 | ||
| 219 | function it_throws_AggregateException_during_checkPredictions_if_predictions_fail( |
|
| 220 | MethodProphecy $methodProphecy1, MethodProphecy $methodProphecy2, |
|
| 221 | ArgumentsWildcard $argumentsWildcard1, |
|
| 222 | ArgumentsWildcard $argumentsWildcard2 |
|
| 223 | ) { |
|
| 224 | $methodProphecy1->getMethodName()->willReturn('getName'); |
|
| 225 | $methodProphecy1->getArgumentsWildcard()->willReturn($argumentsWildcard1); |
|
| 226 | $methodProphecy1->checkPrediction() |
|
| 227 | ->willThrow('Prophecy\Exception\Prediction\AggregateException'); |
|
| 228 | ||
| 229 | $methodProphecy2->getMethodName()->willReturn('setName'); |
|
| 230 | $methodProphecy2->getArgumentsWildcard()->willReturn($argumentsWildcard2); |
|
| 231 | $methodProphecy2->checkPrediction() |
|
| 232 | ->willThrow('Prophecy\Exception\Prediction\AggregateException'); |
|
| 233 | ||
| 234 | $this->addMethodProphecy($methodProphecy1); |
|
| 235 | $this->addMethodProphecy($methodProphecy2); |
|
| 236 | ||
| 237 | $this->shouldThrow('Prophecy\Exception\Prediction\AggregateException') |
|
| 238 | ->duringCheckProphecyMethodsPredictions(); |
|
| 239 | } |
|
| 240 | ||
| 241 | function it_returns_new_MethodProphecy_instance_for_arbitrary_call( |
|
| 242 | Doubler $doubler, |
|