throwException() public static method

public static throwException ( Exception $exception )
$exception Exception
Beispiel #1
0
 /**
  * @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;
 }
Beispiel #2
0
 /**
  * @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');
 }