routeTable = $this->prophesize("\\WellRESTed\\Routing\\RouteTableInterface"); $this->routeTable->addStaticRoute(Argument::cetera())->willReturn(); $this->routeTable->addPrefixRoute(Argument::cetera())->willReturn(); $this->routeTable->addRoute(Argument::cetera())->willReturn(); } public function testRegistersStaticRoute() { $factory = new RouteFactory($this->routeTable->reveal()); $factory->registerRoute("/cats/", null); $this->routeTable->addStaticRoute(Argument::any())->shouldHaveBeenCalled(); } public function testRegistersPrefixRoute() { $factory = new RouteFactory($this->routeTable->reveal()); $factory->registerRoute("/cats/*", null); $this->routeTable->addPrefixRoute(Argument::any())->shouldHaveBeenCalled(); } public function testRegistersTemplateRoute() { $factory = new RouteFactory($this->routeTable->reveal()); $factory->registerRoute("/cats/{catId}", null); $this->routeTable->addRoute(Argument::type("\\WellRESTed\\Routing\\Route\\TemplateRoute"))->shouldHaveBeenCalled(); } public function testRegistersRegexRoute() { $factory = new RouteFactory($this->routeTable->reveal()); $factory->registerRoute("~/cat/[0-9]+~", null); $this->routeTable->addRoute(Argument::type("\\WellRESTed\\Routing\\Route\\RegexRoute"))->shouldHaveBeenCalled(); $this->routeTable->addRoute(Argument::type("\\WellRESTed\\Routing\\Route\\TemplateRoute"))->shouldNotHaveBeenCalled(); } }