public function testPath() { $matcher = new RequestMatcher(); $request = Request::create('/admin/foo'); $matcher->matchPath('/admin/.*'); $this->assertTrue($matcher->matches($request)); $matcher->matchPath('/admin'); $this->assertTrue($matcher->matches($request)); $matcher->matchPath('^/admin/.*$'); $this->assertTrue($matcher->matches($request)); $matcher->matchMethod('/blog/.*'); $this->assertFalse($matcher->matches($request)); }
public function testPathWithEncodedCharacters() { $matcher = new RequestMatcher(); $request = Request::create('/admin/fo%20o'); $matcher->matchPath('^/admin/fo o*$'); $this->assertTrue($matcher->matches($request)); }
public function testPathWithLocale() { $matcher = new RequestMatcher(); $request = Request::create('/en/login'); $session = new Session(new ArraySessionStorage()); $session->setLocale('en'); $request->setSession($session); $matcher->matchPath('^/{_locale}/login$'); $this->assertTrue($matcher->matches($request)); $session->setLocale('de'); $this->assertFalse($matcher->matches($request)); }
public function testPathWithLocaleIsNotSupported() { $matcher = new RequestMatcher(); $request = Request::create('/en/login'); $request->setLocale('en'); $matcher->matchPath('^/{_locale}/login$'); $this->assertFalse($matcher->matches($request)); }