Merge branch '2.4'
* 2.4: removed unneeded use statements [DoctrineBridge] Fixed an issue with DoctrineParserCache removed unneeded use statements Prepend Child Bundle paths before the parent [Routing] add unit tests for Symfony\Component\Routing\RequestContext class
This commit is contained in:
commit
18d69a8ff2
@ -35,7 +35,11 @@ class DoctrineParserCache implements ParserCacheInterface
|
||||
*/
|
||||
public function fetch($key)
|
||||
{
|
||||
return $this->cache->fetch($key);
|
||||
if (false === $value = $this->cache->fetch($key)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -29,6 +29,19 @@ class DoctrineParserCacheTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('bar', $result);
|
||||
}
|
||||
|
||||
public function testFetchUnexisting()
|
||||
{
|
||||
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
|
||||
$parserCache = new DoctrineParserCache($doctrineCacheMock);
|
||||
|
||||
$doctrineCacheMock
|
||||
->expects($this->once())
|
||||
->method('fetch')
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$this->assertNull($parserCache->fetch(''));
|
||||
}
|
||||
|
||||
public function testSave()
|
||||
{
|
||||
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Translation\Catalogue\DiffOperation;
|
||||
use Symfony\Component\Translation\Catalogue\MergeOperation;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
@ -14,7 +14,6 @@ namespace Symfony\Bundle\FrameworkBundle\Controller;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\Templating;
|
||||
|
||||
use Symfony\Component\Templating\DelegatingEngine as BaseDelegatingEngine;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
|
@ -69,13 +69,26 @@ class TwigExtension extends Extension
|
||||
}
|
||||
|
||||
// register bundles as Twig namespaces
|
||||
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
||||
$bundles = $this->getBundlesByChildPriority($container);
|
||||
foreach ($bundles as $bundle => $bundleReflection) {
|
||||
/** @var \Symfony\Component\HttpKernel\Bundle\BundleInterface $bundleInstance */
|
||||
$bundleInstance = $bundleReflection->newInstance();
|
||||
|
||||
if (null !== $parentBundle = $bundleInstance->getParent()) {
|
||||
if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/'.$bundle.'/views')) {
|
||||
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $parentBundle);
|
||||
}
|
||||
|
||||
if (is_dir($dir = $bundleInstance->getPath().'/Resources/views')) {
|
||||
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $parentBundle);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/'.$bundle.'/views')) {
|
||||
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
|
||||
}
|
||||
|
||||
$reflection = new \ReflectionClass($class);
|
||||
if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/views')) {
|
||||
if (is_dir($dir = $bundleInstance->getPath().'/Resources/views')) {
|
||||
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
|
||||
}
|
||||
}
|
||||
@ -130,12 +143,36 @@ class TwigExtension extends Extension
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
* @return array | \ReflectionClass[]
|
||||
*/
|
||||
private function getBundlesByChildPriority(ContainerBuilder $container)
|
||||
{
|
||||
$childBundles = array();
|
||||
$parentBundles = array();
|
||||
|
||||
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
||||
$reflection = new \ReflectionClass($class);
|
||||
|
||||
$bundleInstance = $reflection->newInstance();
|
||||
if (null === $bundleInstance->getParent()) {
|
||||
$parentBundles[$bundle] = $reflection;
|
||||
} else {
|
||||
$childBundles[$bundle] = $reflection;
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge($childBundles, $parentBundles);
|
||||
}
|
||||
|
||||
private function addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle)
|
||||
{
|
||||
$name = $bundle;
|
||||
if ('Bundle' === substr($name, -6)) {
|
||||
$name = substr($name, 0, -6);
|
||||
}
|
||||
|
||||
$twigFilesystemLoaderDefinition->addMethodCall('addPath', array($dir, $name));
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Config\Definition\Builder;
|
||||
|
||||
use Symfony\Component\Config\Definition\EnumNode;
|
||||
use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
|
||||
|
||||
/**
|
||||
* Enum Node Definition.
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Config\Definition;
|
||||
|
||||
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
|
||||
use Symfony\Component\Config\Definition\ScalarNode;
|
||||
|
||||
/**
|
||||
* Node which only allows a finite set of values.
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Config\Definition;
|
||||
|
||||
use Symfony\Component\Config\Definition\VariableNode;
|
||||
use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Console\Output;
|
||||
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
|
||||
use Symfony\Component\Console\Output\ConsoleOutputInterface;
|
||||
|
||||
/**
|
||||
* ConsoleOutput is the default class for all CLI output. It uses STDOUT.
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Console\Output;
|
||||
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* ConsoleOutputInterface is the interface implemented by ConsoleOutput class.
|
||||
* This adds information about stderr output stream.
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Console;
|
||||
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Symfony\Component\Console\Output\ConsoleOutput;
|
||||
use Symfony\Component\Process\ProcessBuilder;
|
||||
|
@ -17,7 +17,6 @@ use Symfony\Component\CssSelector\Node\NodeInterface;
|
||||
use Symfony\Component\CssSelector\Node\SelectorNode;
|
||||
use Symfony\Component\CssSelector\Parser\Parser;
|
||||
use Symfony\Component\CssSelector\Parser\ParserInterface;
|
||||
use Symfony\Component\CssSelector\XPath\Extension;
|
||||
|
||||
/**
|
||||
* XPath expression translator interface.
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Debug;
|
||||
|
||||
use Symfony\Component\Debug\DebugClassLoader;
|
||||
|
||||
/**
|
||||
* Registers all the debug tools.
|
||||
*
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
|
||||
|
||||
/**
|
||||
* This class is used to remove circular dependencies between individual passes.
|
||||
|
@ -24,7 +24,6 @@ use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\Config\Resource\ResourceInterface;
|
||||
use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface;
|
||||
use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator;
|
||||
use Symfony\Component\DependencyInjection\ExpressionLanguage;
|
||||
use Symfony\Component\ExpressionLanguage\Expression;
|
||||
|
||||
/**
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Finder\Tests;
|
||||
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Finder\Adapter;
|
||||
use Symfony\Component\Finder\Tests\FakeAdapter;
|
||||
|
||||
class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
|
@ -12,8 +12,6 @@
|
||||
namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
|
||||
use Symfony\Component\Finder\Tests\Iterator\MockSplFileInfo;
|
||||
use Symfony\Component\Finder\Tests\Iterator\MockFileListIterator;
|
||||
|
||||
class FilecontentFilterIteratorTest extends IteratorTestCase
|
||||
{
|
||||
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Form\Extension\Csrf;
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter;
|
||||
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
|
||||
use Symfony\Component\Form\Extension\Csrf\Type;
|
||||
use Symfony\Component\Form\AbstractExtension;
|
||||
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Form\Extension\Validator;
|
||||
|
||||
use Symfony\Component\Form\Extension\Validator\Type;
|
||||
use Symfony\Component\Form\Extension\Validator\Constraints\Form;
|
||||
use Symfony\Component\Form\AbstractExtension;
|
||||
use Symfony\Component\Validator\ValidatorInterface;
|
||||
|
@ -16,7 +16,6 @@ use Symfony\Component\Form\Util\InheritDataAwareIterator;
|
||||
use Symfony\Component\PropertyAccess\PropertyPathIterator;
|
||||
use Symfony\Component\PropertyAccess\PropertyPathBuilder;
|
||||
use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface;
|
||||
use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator;
|
||||
use Symfony\Component\Form\FormError;
|
||||
use Symfony\Component\Validator\ConstraintViolation;
|
||||
|
||||
|
@ -12,8 +12,6 @@
|
||||
namespace Symfony\Component\Form;
|
||||
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\RequestHandlerInterface;
|
||||
|
||||
/**
|
||||
* A request handler using PHP's super globals $_GET, $_POST and $_SERVER.
|
||||
|
@ -16,7 +16,6 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\HttpFoundation\Session\Storage;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
|
||||
|
||||
/**
|
||||
* MockArraySessionStorage mocks the session for unit tests.
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation\Session\Storage;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\HttpFoundation\Session\Storage;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
|
||||
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
|
||||
|
||||
/**
|
||||
* StorageInterface.
|
||||
|
@ -17,7 +17,6 @@ use Symfony\Component\BrowserKit\Response as DomResponse;
|
||||
use Symfony\Component\BrowserKit\Cookie as DomCookie;
|
||||
use Symfony\Component\BrowserKit\History;
|
||||
use Symfony\Component\BrowserKit\CookieJar;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
|
@ -15,7 +15,6 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpKernel\Debug\ErrorHandler;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
|
||||
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
|
||||
|
||||
/**
|
||||
* LogDataCollector.
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
|
@ -14,7 +14,6 @@ namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
|
||||
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
|
||||
|
||||
/**
|
||||
|
@ -11,12 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpKernel\DataCollector;
|
||||
|
||||
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
|
||||
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
|
||||
/**
|
||||
* TimeDataCollector.
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\DependencyInjection;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
|
||||
use Symfony\Component\HttpKernel\Kernel;
|
||||
|
||||
/**
|
||||
|
@ -19,7 +19,6 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\TerminableInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpCache\Esi;
|
||||
|
||||
/**
|
||||
* Cache provides HTTP caching.
|
||||
|
@ -24,7 +24,6 @@ use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Symfony\Component\HttpKernel\Config\FileLocator;
|
||||
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\HttpKernel;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\Profiler;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface;
|
||||
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
|
||||
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Intl\DateFormatter\DateFormat;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
use Symfony\Component\Intl\Globals\IntlGlobals;
|
||||
use Symfony\Component\Intl\DateFormatter\DateFormat\MonthTransformer;
|
||||
|
||||
/**
|
||||
* Parser and formatter for date formats
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Intl\Exception;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
|
||||
/**
|
||||
* @author Eriksen Costa <eriksen.costa@infranology.com.br>
|
||||
*/
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Intl\Exception;
|
||||
|
||||
use Symfony\Component\Intl\Exception\NotImplementedException;
|
||||
|
||||
/**
|
||||
* @author Eriksen Costa <eriksen.costa@infranology.com.br>
|
||||
*/
|
||||
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Routing\Matcher;
|
||||
use Symfony\Component\Routing\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
use Symfony\Component\Routing\Matcher\UrlMatcher;
|
||||
|
||||
/**
|
||||
* TraceableUrlMatcher helps debug path info matching by tracing the match.
|
||||
|
101
src/Symfony/Component/Routing/Tests/RequestContextTest.php
Normal file
101
src/Symfony/Component/Routing/Tests/RequestContextTest.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Routing\Tests;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Routing\RequestContext;
|
||||
|
||||
class RequestContextTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$requestContext = new RequestContext(
|
||||
'foo',
|
||||
'post',
|
||||
'foo.bar',
|
||||
'HTTPS',
|
||||
8080,
|
||||
444,
|
||||
'/baz',
|
||||
'bar=foobar'
|
||||
);
|
||||
|
||||
$this->assertEquals('foo', $requestContext->getBaseUrl());
|
||||
$this->assertEquals('POST', $requestContext->getMethod());
|
||||
$this->assertEquals('foo.bar', $requestContext->getHost());
|
||||
$this->assertEquals('https', $requestContext->getScheme());
|
||||
$this->assertSame(8080, $requestContext->getHttpPort());
|
||||
$this->assertSame(444, $requestContext->getHttpsPort());
|
||||
$this->assertEquals('/baz', $requestContext->getPathInfo());
|
||||
$this->assertEquals('bar=foobar', $requestContext->getQueryString());
|
||||
}
|
||||
|
||||
public function testFromRequest()
|
||||
{
|
||||
$request = Request::create('https://test.com:444/foo?bar=baz');
|
||||
$requestContext = new RequestContext();
|
||||
$requestContext->setHttpPort(123);
|
||||
$requestContext->fromRequest($request);
|
||||
|
||||
$this->assertEquals('', $requestContext->getBaseUrl());
|
||||
$this->assertEquals('GET', $requestContext->getMethod());
|
||||
$this->assertEquals('test.com', $requestContext->getHost());
|
||||
$this->assertEquals('https', $requestContext->getScheme());
|
||||
$this->assertEquals('/foo', $requestContext->getPathInfo());
|
||||
$this->assertEquals('bar=baz', $requestContext->getQueryString());
|
||||
$this->assertSame(123, $requestContext->getHttpPort());
|
||||
$this->assertSame(444, $requestContext->getHttpsPort());
|
||||
|
||||
$request = Request::create('http://test.com:8080/foo?bar=baz');
|
||||
$requestContext = new RequestContext();
|
||||
$requestContext->setHttpsPort(567);
|
||||
$requestContext->fromRequest($request);
|
||||
|
||||
$this->assertSame(8080, $requestContext->getHttpPort());
|
||||
$this->assertSame(567, $requestContext->getHttpsPort());
|
||||
}
|
||||
|
||||
public function testGetParameters()
|
||||
{
|
||||
$requestContext = new RequestContext();
|
||||
$this->assertEquals(array(), $requestContext->getParameters());
|
||||
|
||||
$requestContext->setParameters(array('foo' => 'bar'));
|
||||
$this->assertEquals(array('foo' => 'bar'), $requestContext->getParameters());
|
||||
}
|
||||
|
||||
public function testHasParameter()
|
||||
{
|
||||
$requestContext = new RequestContext();
|
||||
$requestContext->setParameters(array('foo' => 'bar'));
|
||||
|
||||
$this->assertTrue($requestContext->hasParameter('foo'));
|
||||
$this->assertFalse($requestContext->hasParameter('baz'));
|
||||
}
|
||||
|
||||
public function testGetParameter()
|
||||
{
|
||||
$requestContext = new RequestContext();
|
||||
$requestContext->setParameters(array('foo' => 'bar'));
|
||||
|
||||
$this->assertEquals('bar', $requestContext->getParameter('foo'));
|
||||
$this->assertNull($requestContext->getParameter('baz'));
|
||||
}
|
||||
|
||||
public function testSetParameter()
|
||||
{
|
||||
$requestContext = new RequestContext();
|
||||
$requestContext->setParameter('foo', 'bar');
|
||||
|
||||
$this->assertEquals('bar', $requestContext->getParameter('foo'));
|
||||
}
|
||||
}
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Security\Core\Encoder;
|
||||
|
||||
use Symfony\Component\Security\Core\Encoder\BasePasswordEncoder;
|
||||
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
|
||||
|
||||
/**
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Security\Core\Exception;
|
||||
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
|
||||
/**
|
||||
* NonceExpiredException is thrown when an authentication is rejected because
|
||||
* the digest nonce has expired.
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Security\Http\EntryPoint;
|
||||
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Security\Http\EntryPoint;
|
||||
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
||||
use Symfony\Component\Security\Core\Exception\NonceExpiredException;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Http\EntryPoint;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
||||
use Symfony\Component\Security\Http\HttpUtils;
|
||||
use Symfony\Component\HttpKernel\HttpKernelInterface;
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
namespace Symfony\Component\Security\Http\EntryPoint;
|
||||
|
||||
use Symfony\Component\Security\Core\Exception\AuthenticationException;
|
||||
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Http\Logout;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\Security\Http\HttpUtils;
|
||||
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
|
||||
|
||||
/**
|
||||
* Default logout success handler will redirect users to a configured path.
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Serializer\Encoder;
|
||||
|
||||
use Symfony\Component\Serializer\Encoder\DecoderInterface;
|
||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||
|
||||
/**
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Serializer\Encoder;
|
||||
|
||||
use Symfony\Component\Serializer\Encoder\EncoderInterface;
|
||||
use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface;
|
||||
use Symfony\Component\Serializer\Exception\RuntimeException;
|
||||
|
||||
/**
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Serializer;
|
||||
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
|
||||
/**
|
||||
* Defines the interface of encoders
|
||||
*
|
||||
|
@ -11,9 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Templating;
|
||||
|
||||
use Symfony\Component\Templating\TemplateReferenceInterface;
|
||||
use Symfony\Component\Templating\TemplateReference;
|
||||
|
||||
/**
|
||||
* TemplateNameParser is the default implementation of TemplateNameParserInterface.
|
||||
*
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* Specifies an object able to return the correct ConstraintValidatorInterface
|
||||
* instance given a Constraint object.
|
||||
|
@ -12,8 +12,6 @@
|
||||
namespace Symfony\Component\Validator\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\Constraints\Required;
|
||||
use Symfony\Component\Validator\Constraints\Optional;
|
||||
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Validator\Constraints;
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
use Symfony\Component\Validator\ConstraintValidator;
|
||||
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Validator\Constraints\Optional;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\EqualTo;
|
||||
use Symfony\Component\Validator\Constraints\EqualToValidator;
|
||||
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
|
||||
|
||||
/**
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\IdenticalTo;
|
||||
use Symfony\Component\Validator\Constraints\IdenticalToValidator;
|
||||
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
|
||||
|
||||
/**
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotEqualTo;
|
||||
use Symfony\Component\Validator\Constraints\NotEqualToValidator;
|
||||
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
|
||||
|
||||
/**
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
|
@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
|
||||
|
||||
use Symfony\Component\Validator\Constraints\NotIdenticalTo;
|
||||
use Symfony\Component\Validator\Constraints\NotIdenticalToValidator;
|
||||
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
|
||||
|
||||
/**
|
||||
* @author Daniel Holmes <daniel@danielholmes.org>
|
||||
|
@ -11,8 +11,6 @@
|
||||
|
||||
namespace Symfony\Component\Validator;
|
||||
|
||||
use Symfony\Component\Validator\Constraint;
|
||||
|
||||
/**
|
||||
* Validates values and graphs of objects and arrays.
|
||||
*
|
||||
|
Reference in New Issue
Block a user