Example #1
0
 public function testNormalizeUrl()
 {
     $collection = new RouteCollection();
     $collection->add('foo', new Route('/{foo}'));
     $matcher = new UrlMatcherForTests($collection, array(), array());
     $this->assertEquals('/foo', $matcher->normalizeUrl('/foo?foo=bar'), '->normalizeUrl() removes the query string');
     $this->assertEquals('/foo/bar', $matcher->normalizeUrl('/foo//bar'), '->normalizeUrl() removes duplicated /');
 }
Example #2
0
 public function testNormalizeUrl()
 {
     $collection = new RouteCollection();
     $collection->addRoute('foo', new Route('/:foo'));
     $matcher = new UrlMatcherForTests($collection, array(), array());
     $this->assertEquals('/', $matcher->normalizeUrl(''), '->normalizeUrl() adds a / at the beginning of the URL if needed');
     $this->assertEquals('/foo', $matcher->normalizeUrl('foo'), '->normalizeUrl() adds a / at the beginning of the URL if needed');
     $this->assertEquals('/foo', $matcher->normalizeUrl('/foo?foo=bar'), '->normalizeUrl() removes the query string');
     $this->assertEquals('/foo/bar', $matcher->normalizeUrl('/foo//bar'), '->normalizeUrl() removes duplicated /');
 }