/** * @param mixed ... * @return $this */ public function thenThrow($exception) { foreach (func_get_args() as $exception) { $this->mock->_stubbed_calls[] = new CallStub($this->methodCall, Functions::throwException($exception)); } return $this; }
/** * @test */ public function shouldInvokeFirstLastTieBreaker() { //given $tieBreaker2 = Functions::throwException(new Exception('second should be invoked')); $alwaysEqual = Functions::constant(0); $comparator = Comparator::compound($alwaysEqual, $alwaysEqual, $tieBreaker2); //when CatchException::when(new CallableWrapper($comparator))->call(null, null); //then CatchException::assertThat()->hasMessage('second should be invoked'); }