composer update
This commit is contained in:
parent
f6abc3dce2
commit
71dfaca858
1753 changed files with 45274 additions and 14619 deletions
|
|
@ -181,7 +181,7 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
|||
$this->assertEquals(array_merge($classRouteData['methods'], $methodRouteData['methods']), $route->getMethods(), '->load merges class and method route methods');
|
||||
}
|
||||
|
||||
public function testInvokableClassRouteLoad()
|
||||
public function testInvokableClassRouteLoadWithMethodAnnotation()
|
||||
{
|
||||
$classRouteData = array(
|
||||
'name' => 'route1',
|
||||
|
|
@ -209,6 +209,41 @@ class AnnotationClassLoaderTest extends AbstractAnnotationLoaderTest
|
|||
$this->assertEquals($classRouteData['methods'], $route->getMethods(), '->load preserves class route methods');
|
||||
}
|
||||
|
||||
public function testInvokableClassRouteLoadWithClassAnnotation()
|
||||
{
|
||||
$classRouteData = array(
|
||||
'name' => 'route1',
|
||||
'path' => '/',
|
||||
'schemes' => array('https'),
|
||||
'methods' => array('GET'),
|
||||
);
|
||||
|
||||
$this->reader
|
||||
->expects($this->exactly(1))
|
||||
->method('getClassAnnotation')
|
||||
->will($this->returnValue($this->getAnnotatedRoute($classRouteData)))
|
||||
;
|
||||
|
||||
$this->reader
|
||||
->expects($this->exactly(1))
|
||||
->method('getClassAnnotations')
|
||||
->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData))))
|
||||
;
|
||||
|
||||
$this->reader
|
||||
->expects($this->once())
|
||||
->method('getMethodAnnotations')
|
||||
->will($this->returnValue(array()))
|
||||
;
|
||||
|
||||
$routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass');
|
||||
$route = $routeCollection->get($classRouteData['name']);
|
||||
|
||||
$this->assertSame($classRouteData['path'], $route->getPath(), '->load preserves class route path');
|
||||
$this->assertEquals($classRouteData['schemes'], $route->getSchemes(), '->load preserves class route schemes');
|
||||
$this->assertEquals($classRouteData['methods'], $route->getMethods(), '->load preserves class route methods');
|
||||
}
|
||||
|
||||
public function testInvokableClassMultipleRouteLoad()
|
||||
{
|
||||
$classRouteData1 = array(
|
||||
|
|
|
|||
|
|
@ -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