/** * Test any method * * @return void */ public function testAny() { $testInstance = new RouteCollection(); $testInstance->any('test.com/test', function () { }); $definedRoute = $testInstance->getRoutes()[0]; $this->assertEquals(Method::ANY, $definedRoute->getMethod()); $this->assertEquals('test.com/test', $definedRoute->getUrl()); $this->assertTrue($this->_isClosure($definedRoute->getHandler())); }
/** * testAnonymousFunctionStaticAny * * @return void */ public function testAnonymousFunctionStaticAny() { $routeCollection = new RouteCollection(); $routeCollection->any('/homepage/', function () { return 'any'; }); $matcher = new Matcher($routeCollection, new DispatcherClosure()); $executed = $matcher->matchRoute(Method::POST, '/homepage/'); $this->assertEquals('any', $executed); }