mirror of
https://gitlab.com/TheGamecraft/c-cms.git
synced 2026-04-25 04:09:11 -04:00
ALPHA 3.0.2a
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user