/** * @param string $method * @param array $arguments * @return \PhpSpec\Exception\Fracture\MethodNotFoundException|\PhpSpec\Exception\Fracture\MethodNotVisibleException */ private function methodNotFound($method, array $arguments = array()) { $className = $this->wrappedObject->getClassName(); if (!method_exists($className, $method)) { return $this->exceptionFactory->methodNotFound($className, $method, $arguments); } return $this->exceptionFactory->methodNotVisible($className, $method, $arguments); }
function it_delegates_throwing_method_not_found_exception_for_constructor(WrappedObject $wrappedObject, ExceptionFactory $exceptions, \stdClass $argument) { $obj = new ExampleClass(); $wrappedObject->isInstantiated()->willReturn(false); $wrappedObject->getInstance()->willReturn(null); $wrappedObject->getArguments()->willReturn(array($argument)); $wrappedObject->getClassName()->willReturn('spec\\PhpSpec\\Wrapper\\Subject\\ExampleClass'); $exceptions->methodNotFound('spec\\PhpSpec\\Wrapper\\Subject\\ExampleClass', '__construct', array($argument))->willReturn(new \PhpSpec\Exception\Fracture\MethodNotFoundException('Method "__construct" not found.', $obj, '"ExampleClass::__construct"', array()))->shouldBeCalled(); $this->shouldThrow('\\PhpSpec\\Exception\\Fracture\\MethodNotFoundException')->duringCall('__construct'); }