mock_objects.php
public function throwOn($method, $exception = false, $args = false)
    {
        $this->dieOnNoMethod($method, 'throw on');
        $this->actions->register($method, $args,
                new SimpleThrower($exception ? $exception : new Exception()));
    }
public function throwOn($method, $exception = false, $args = false)
    {
        $this->dieOnNoMethod($method, 'throw on');
        $this->actions->register($method, $args,
                new SimpleThrower($exception ? $exception : new Exception()));
    }
public function throwOn ( $ method , $ exception = false , $ args = false ) { $ this -> dieOnNoMethod ( $ method , 'throw on' ) ; $ this -> actions -> register ( $ method , $ args , new SimpleThrower ( $ exception ? $ exception : new Exception ( ) ) ) ; }
Sets up a trigger to throw an exception upon the method call.

@param string $method     Method name to throw on.
@param object $exception  Exception object to throw.
If not given then a simple Exception object is thrown.
@param array $args        Optional argument list filter.
If given then the exception will only
be thrown if the method call matches the arguments.
Sets up a trigger to throw an exception upon the method call .