prophesize("\\pjdietz\\WellRESTed\\Interfaces\\HandlerInterface"); return $handler->reveal(); }; $route = new StaticRoute($this->path, $target); $route->getResponse($this->request->reveal()); } public function testDispatchesHandlerFromString() { $target = __NAMESPACE__ . "\\ValidHandler"; $route = new StaticRoute($this->path, $target); $route->getResponse($this->request->reveal()); } public function testDispatchesHandlerInstance() { $target = new ValidHandler(); $route = new StaticRoute($this->path, $target); $route->getResponse($this->request->reveal()); } /** * @expectedException \UnexpectedValueException */ public function testThrowsExceptionWhenHandlerDoesNotImplementInterface() { $target = "\\stdClass"; $route = new StaticRoute($this->path, $target); $route->getResponse($this->request->reveal()); } public function setUp() { $this->request = $this->prophesize("\\pjdietz\\WellRESTed\\Interfaces\\RequestInterface"); $this->request->getPath()->willReturn($this->path); } } class ValidHandler implements HandlerInterface { public function getResponse(RequestInterface $request, array $args = null) { return null; } }