ALPHA 3.0.2a

This commit is contained in:
TheGamecraft
2018-09-10 08:51:18 -04:00
parent 7fe13ae0a7
commit 0e0ef86b71
1404 changed files with 10604 additions and 33714 deletions

View File

@@ -14,8 +14,8 @@ namespace Symfony\Component\Routing\Tests\Matcher;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
class DumpedRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest
{

View File

@@ -12,8 +12,8 @@
namespace Symfony\Component\Routing\Tests\Matcher;
use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
class DumpedUrlMatcherTest extends UrlMatcherTest
{

View File

@@ -36,7 +36,7 @@ class PhpMatcherDumperTest extends TestCase
parent::setUp();
$this->matcherClass = uniqid('ProjectUrlMatcher');
$this->dumpPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
$this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
}
protected function tearDown()
@@ -491,6 +491,18 @@ class PhpMatcherDumperTest extends TestCase
return $this->matcherClass;
}
/**
* @expectedException \InvalidArgumentException
* @expectedExceptionMessage Symfony\Component\Routing\Route cannot contain objects
*/
public function testGenerateDumperMatcherWithObject()
{
$routeCollection = new RouteCollection();
$routeCollection->add('_', new Route('/', array(new \stdClass())));
$dumper = new PhpMatcherDumper($routeCollection);
$dumper->dump();
}
}
abstract class RedirectableUrlMatcherStub extends UrlMatcher implements RedirectableUrlMatcherInterface

View File

@@ -11,9 +11,9 @@
namespace Symfony\Component\Routing\Tests\Matcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
class RedirectableUrlMatcherTest extends UrlMatcherTest
{
@@ -93,6 +93,20 @@ class RedirectableUrlMatcherTest extends UrlMatcherTest
$this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'redirect' => 'value'), $matcher->match('/foo/baz'));
}
public function testSchemeRedirectForRoot()
{
$coll = new RouteCollection();
$coll->add('foo', new Route('/', array(), array(), array(), '', array('https')));
$matcher = $this->getUrlMatcher($coll);
$matcher
->expects($this->once())
->method('redirect')
->with('/', 'foo', 'https')
->will($this->returnValue(array('redirect' => 'value')));
$this->assertEquals(array('_route' => 'foo', 'redirect' => 'value'), $matcher->match('/'));
}
public function testSlashRedirectWithParams()
{
$coll = new RouteCollection();

View File

@@ -13,10 +13,10 @@ namespace Symfony\Component\Routing\Tests\Matcher;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Matcher\TraceableUrlMatcher;
class TraceableUrlMatcherTest extends TestCase
{

View File

@@ -15,9 +15,9 @@ use PHPUnit\Framework\TestCase;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\RequestContext;
class UrlMatcherTest extends TestCase
{
@@ -670,6 +670,16 @@ class UrlMatcherTest extends TestCase
$this->assertEquals('c', $matcher->match('/admin/api/package.json')['_route']);
}
public function testHostWithDot()
{
$coll = new RouteCollection();
$coll->add('a', new Route('/foo', array(), array(), array(), 'foo.example.com'));
$coll->add('b', new Route('/bar/{baz}'));
$matcher = $this->getUrlMatcher($coll);
$this->assertEquals('b', $matcher->match('/bar/abc.123')['_route']);
}
protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
{
return new UrlMatcher($routes, $context ?: new RequestContext());