composer update
This commit is contained in:
parent
f6abc3dce2
commit
71dfaca858
1753 changed files with 45274 additions and 14619 deletions
|
@ -430,9 +430,6 @@ class PhpMatcherDumperTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $dumper
|
||||
*/
|
||||
private function generateDumpedMatcher(RouteCollection $collection, $redirectableStub = false)
|
||||
{
|
||||
$options = array('class' => $this->matcherClass);
|
||||
|
|
|
@ -117,6 +117,34 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
|
|||
$this->assertSame(array('_route' => 'foo'), $matcher->match('/foo'));
|
||||
}
|
||||
|
||||
public function testFallbackPage()
|
||||
{
|
||||
$coll = new RouteCollection();
|
||||
$coll->add('foo', new Route('/foo/'));
|
||||
$coll->add('bar', new Route('/{name}'));
|
||||
|
||||
$matcher = $this->getUrlMatcher($coll);
|
||||
$matcher->expects($this->once())->method('redirect')->with('/foo/')->will($this->returnValue(array('_route' => 'foo')));
|
||||
$this->assertSame(array('_route' => 'foo'), $matcher->match('/foo'));
|
||||
}
|
||||
|
||||
public function testSlashAndVerbPrecedenceWithRedirection()
|
||||
{
|
||||
$coll = new RouteCollection();
|
||||
$coll->add('a', new Route('/api/customers/{customerId}/contactpersons', array(), array(), array(), '', array(), array('post')));
|
||||
$coll->add('b', new Route('/api/customers/{customerId}/contactpersons/', array(), array(), array(), '', array(), array('get')));
|
||||
|
||||
$matcher = $this->getUrlMatcher($coll);
|
||||
$expected = array(
|
||||
'_route' => 'b',
|
||||
'customerId' => '123',
|
||||
);
|
||||
$this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons/'));
|
||||
|
||||
$matcher->expects($this->once())->method('redirect')->with('/api/customers/123/contactpersons/')->willReturn(array());
|
||||
$this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons'));
|
||||
}
|
||||
|
||||
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
|
||||
{
|
||||
return $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($routes, $context ?: new RequestContext()));
|
||||
|
|
|
@ -502,6 +502,31 @@ class UrlMatcherTest extends TestCase
|
|||
$matcher->match('/');
|
||||
}
|
||||
|
||||
public function testSlashAndVerbPrecedence()
|
||||
{
|
||||
$coll = new RouteCollection();
|
||||
$coll->add('a', new Route('/api/customers/{customerId}/contactpersons/', array(), array(), array(), '', array(), array('post')));
|
||||
$coll->add('b', new Route('/api/customers/{customerId}/contactpersons', array(), array(), array(), '', array(), array('get')));
|
||||
|
||||
$matcher = $this->getUrlMatcher($coll);
|
||||
$expected = array(
|
||||
'_route' => 'b',
|
||||
'customerId' => '123',
|
||||
);
|
||||
$this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons'));
|
||||
|
||||
$coll = new RouteCollection();
|
||||
$coll->add('a', new Route('/api/customers/{customerId}/contactpersons/', array(), array(), array(), '', array(), array('get')));
|
||||
$coll->add('b', new Route('/api/customers/{customerId}/contactpersons', array(), array(), array(), '', array(), array('post')));
|
||||
|
||||
$matcher = $this->getUrlMatcher($coll, new RequestContext('', 'POST'));
|
||||
$expected = array(
|
||||
'_route' => 'b',
|
||||
'customerId' => '123',
|
||||
);
|
||||
$this->assertEquals($expected, $matcher->match('/api/customers/123/contactpersons'));
|
||||
}
|
||||
|
||||
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
|
||||
{
|
||||
return new UrlMatcher($routes, $context ?: new RequestContext());
|
||||
|
|
Reference in a new issue