Merge branch '2.3' into 2.4

* 2.3:
  removed unneeded use statements
  Prepend Child Bundle paths before the parent
  [Routing] add unit tests for Symfony\Component\Routing\RequestContext class

Conflicts:
	src/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php
	src/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php
	src/Symfony/Component/Validator/ConstraintValidatorFactory.php
This commit is contained in:
Fabien Potencier 2014-01-01 09:14:50 +01:00
commit e0402bae65
56 changed files with 141 additions and 77 deletions

View File

@ -11,7 +11,6 @@
namespace Symfony\Bundle\FrameworkBundle\Command; namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Translation\Catalogue\DiffOperation; use Symfony\Component\Translation\Catalogue\DiffOperation;
use Symfony\Component\Translation\Catalogue\MergeOperation; use Symfony\Component\Translation\Catalogue\MergeOperation;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;

View File

@ -14,7 +14,6 @@ namespace Symfony\Bundle\FrameworkBundle\Controller;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver; use Symfony\Component\HttpKernel\Controller\ControllerResolver as BaseControllerResolver;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser;
use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareInterface;
/** /**

View File

@ -13,7 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\Templating;
use Symfony\Component\Templating\DelegatingEngine as BaseDelegatingEngine; use Symfony\Component\Templating\DelegatingEngine as BaseDelegatingEngine;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
/** /**

View File

@ -69,13 +69,26 @@ class TwigExtension extends Extension
} }
// register bundles as Twig namespaces // 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')) { if (is_dir($dir = $container->getParameter('kernel.root_dir').'/Resources/'.$bundle.'/views')) {
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle); $this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
} }
$reflection = new \ReflectionClass($class); if (is_dir($dir = $bundleInstance->getPath().'/Resources/views')) {
if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/views')) {
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle); $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) private function addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle)
{ {
$name = $bundle; $name = $bundle;
if ('Bundle' === substr($name, -6)) { if ('Bundle' === substr($name, -6)) {
$name = substr($name, 0, -6); $name = substr($name, 0, -6);
} }
$twigFilesystemLoaderDefinition->addMethodCall('addPath', array($dir, $name)); $twigFilesystemLoaderDefinition->addMethodCall('addPath', array($dir, $name));
} }

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Config\Definition\Builder; namespace Symfony\Component\Config\Definition\Builder;
use Symfony\Component\Config\Definition\EnumNode; use Symfony\Component\Config\Definition\EnumNode;
use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition;
/** /**
* Enum Node Definition. * Enum Node Definition.

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Config\Definition; namespace Symfony\Component\Config\Definition;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
use Symfony\Component\Config\Definition\ScalarNode;
/** /**
* Node which only allows a finite set of values. * Node which only allows a finite set of values.

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Config\Definition; namespace Symfony\Component\Config\Definition;
use Symfony\Component\Config\Definition\VariableNode;
use Symfony\Component\Config\Definition\Exception\InvalidTypeException; use Symfony\Component\Config\Definition\Exception\InvalidTypeException;
/** /**

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Console\Output; namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
/** /**
* ConsoleOutput is the default class for all CLI output. It uses STDOUT. * ConsoleOutput is the default class for all CLI output. It uses STDOUT.

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Console\Output; namespace Symfony\Component\Console\Output;
use Symfony\Component\Console\Output\OutputInterface;
/** /**
* ConsoleOutputInterface is the interface implemented by ConsoleOutput class. * ConsoleOutputInterface is the interface implemented by ConsoleOutput class.
* This adds information about stderr output stream. * This adds information about stderr output stream.

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Console; namespace Symfony\Component\Console;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Process\ProcessBuilder; use Symfony\Component\Process\ProcessBuilder;

View File

@ -17,7 +17,6 @@ use Symfony\Component\CssSelector\Node\NodeInterface;
use Symfony\Component\CssSelector\Node\SelectorNode; use Symfony\Component\CssSelector\Node\SelectorNode;
use Symfony\Component\CssSelector\Parser\Parser; use Symfony\Component\CssSelector\Parser\Parser;
use Symfony\Component\CssSelector\Parser\ParserInterface; use Symfony\Component\CssSelector\Parser\ParserInterface;
use Symfony\Component\CssSelector\XPath\Extension;
/** /**
* XPath expression translator interface. * XPath expression translator interface.

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\DependencyInjection\Compiler; namespace Symfony\Component\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
/** /**
* This class is used to remove circular dependencies between individual passes. * This class is used to remove circular dependencies between individual passes.

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Finder\Tests;
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\Adapter; use Symfony\Component\Finder\Adapter;
use Symfony\Component\Finder\Tests\FakeAdapter;
class FinderTest extends Iterator\RealIteratorTestCase class FinderTest extends Iterator\RealIteratorTestCase
{ {

View File

@ -12,8 +12,6 @@
namespace Symfony\Component\Finder\Tests\Iterator; namespace Symfony\Component\Finder\Tests\Iterator;
use Symfony\Component\Finder\Iterator\FilecontentFilterIterator; use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
use Symfony\Component\Finder\Tests\Iterator\MockSplFileInfo;
use Symfony\Component\Finder\Tests\Iterator\MockFileListIterator;
class FilecontentFilterIteratorTest extends IteratorTestCase class FilecontentFilterIteratorTest extends IteratorTestCase
{ {

View File

@ -13,11 +13,6 @@ namespace Symfony\Component\Form\Extension\Csrf;
use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter; 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;
/** /**
* This extension protects forms by using a CSRF token. * This extension protects forms by using a CSRF token.

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Form\Extension\Validator; 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\Extension\Validator\Constraints\Form;
use Symfony\Component\Form\AbstractExtension; use Symfony\Component\Form\AbstractExtension;
use Symfony\Component\Validator\ValidatorInterface; use Symfony\Component\Validator\ValidatorInterface;

View File

@ -16,7 +16,6 @@ use Symfony\Component\Form\Util\InheritDataAwareIterator;
use Symfony\Component\PropertyAccess\PropertyPathIterator; use Symfony\Component\PropertyAccess\PropertyPathIterator;
use Symfony\Component\PropertyAccess\PropertyPathBuilder; use Symfony\Component\PropertyAccess\PropertyPathBuilder;
use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface; use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface;
use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator;
use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormError;
use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolation;

View File

@ -12,8 +12,6 @@
namespace Symfony\Component\Form; namespace Symfony\Component\Form;
use Symfony\Component\Form\Exception\UnexpectedTypeException; 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. * A request handler using PHP's super globals $_GET, $_POST and $_SERVER.

View File

@ -16,7 +16,6 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
/** /**

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Session\Storage; namespace Symfony\Component\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface; use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
/** /**
* MockArraySessionStorage mocks the session for unit tests. * MockArraySessionStorage mocks the session for unit tests.

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface; use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; 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\NativeProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy;

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\HttpFoundation\Session\Storage; 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\Proxy\AbstractProxy;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler;

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\HttpFoundation\Session\Storage; namespace Symfony\Component\HttpFoundation\Session\Storage;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface; use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
/** /**
* StorageInterface. * StorageInterface.

View File

@ -17,7 +17,6 @@ use Symfony\Component\BrowserKit\Response as DomResponse;
use Symfony\Component\BrowserKit\Cookie as DomCookie; use Symfony\Component\BrowserKit\Cookie as DomCookie;
use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\History;
use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\HttpKernel\TerminableInterface;
use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;

View File

@ -14,7 +14,6 @@ namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
/** /**

View File

@ -13,10 +13,6 @@ namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; 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;
/** /**
* TimeDataCollector. * TimeDataCollector.

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;
/** /**

View File

@ -19,7 +19,6 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\TerminableInterface; use Symfony\Component\HttpKernel\TerminableInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpCache\Esi;
/** /**
* Cache provides HTTP caching. * Cache provides HTTP caching.

View File

@ -24,7 +24,6 @@ use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader; use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Config\FileLocator; use Symfony\Component\HttpKernel\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\HttpKernel; namespace Symfony\Component\HttpKernel;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\Loader\LoaderInterface;

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\HttpKernel\Profiler;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Profiler\ProfilerStorageInterface;
use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Intl\DateFormatter\DateFormat;
use Symfony\Component\Intl\Exception\NotImplementedException; use Symfony\Component\Intl\Exception\NotImplementedException;
use Symfony\Component\Intl\Globals\IntlGlobals; use Symfony\Component\Intl\Globals\IntlGlobals;
use Symfony\Component\Intl\DateFormatter\DateFormat\MonthTransformer;
/** /**
* Parser and formatter for date formats * Parser and formatter for date formats

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Intl\Exception; namespace Symfony\Component\Intl\Exception;
use Symfony\Component\Intl\Exception\NotImplementedException;
/** /**
* @author Eriksen Costa <eriksen.costa@infranology.com.br> * @author Eriksen Costa <eriksen.costa@infranology.com.br>
*/ */

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Intl\Exception; namespace Symfony\Component\Intl\Exception;
use Symfony\Component\Intl\Exception\NotImplementedException;
/** /**
* @author Eriksen Costa <eriksen.costa@infranology.com.br> * @author Eriksen Costa <eriksen.costa@infranology.com.br>
*/ */

View File

@ -14,7 +14,6 @@ namespace Symfony\Component\Routing\Matcher;
use Symfony\Component\Routing\Exception\ExceptionInterface; use Symfony\Component\Routing\Exception\ExceptionInterface;
use Symfony\Component\Routing\Route; use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Matcher\UrlMatcher;
/** /**
* TraceableUrlMatcher helps debug path info matching by tracing the match. * TraceableUrlMatcher helps debug path info matching by tracing the match.

View 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'));
}
}

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Security\Core\Encoder; namespace Symfony\Component\Security\Core\Encoder;
use Symfony\Component\Security\Core\Encoder\BasePasswordEncoder;
use Symfony\Component\Security\Core\Exception\BadCredentialsException; use Symfony\Component\Security\Core\Exception\BadCredentialsException;
/** /**

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Security\Core\Exception; namespace Symfony\Component\Security\Core\Exception;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
/** /**
* NonceExpiredException is thrown when an authentication is rejected because * NonceExpiredException is thrown when an authentication is rejected because
* the digest nonce has expired. * the digest nonce has expired.

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\EntryPoint; namespace Symfony\Component\Security\Http\EntryPoint;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\EntryPoint; namespace Symfony\Component\Security\Http\EntryPoint;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\Security\Core\Exception\NonceExpiredException; use Symfony\Component\Security\Core\Exception\NonceExpiredException;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Http\EntryPoint;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\Security\Http\HttpUtils; use Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernelInterface;

View File

@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Http\EntryPoint; namespace Symfony\Component\Security\Http\EntryPoint;
use Symfony\Component\Security\Core\Exception\AuthenticationException; use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Security\Http\Logout;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\HttpUtils; use Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
/** /**
* Default logout success handler will redirect users to a configured path. * Default logout success handler will redirect users to a configured path.

View File

@ -11,7 +11,6 @@
namespace Symfony\Component\Serializer\Encoder; namespace Symfony\Component\Serializer\Encoder;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Exception\RuntimeException; use Symfony\Component\Serializer\Exception\RuntimeException;
/** /**

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Serializer\Encoder; namespace Symfony\Component\Serializer\Encoder;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface;
use Symfony\Component\Serializer\Exception\RuntimeException; use Symfony\Component\Serializer\Exception\RuntimeException;
/** /**

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Serializer; namespace Symfony\Component\Serializer;
use Symfony\Component\Serializer\SerializerInterface;
/** /**
* Defines the interface of encoders * Defines the interface of encoders
* *

View File

@ -11,9 +11,6 @@
namespace Symfony\Component\Templating; namespace Symfony\Component\Templating;
use Symfony\Component\Templating\TemplateReferenceInterface;
use Symfony\Component\Templating\TemplateReference;
/** /**
* TemplateNameParser is the default implementation of TemplateNameParserInterface. * TemplateNameParser is the default implementation of TemplateNameParserInterface.
* *

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Validator; namespace Symfony\Component\Validator;
use Symfony\Component\Validator\Constraint;
/** /**
* Specifies an object able to return the correct ConstraintValidatorInterface * Specifies an object able to return the correct ConstraintValidatorInterface
* instance given a Constraint object. * instance given a Constraint object.

View File

@ -12,8 +12,6 @@
namespace Symfony\Component\Validator\Constraints; namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Constraints\Required;
use Symfony\Component\Validator\Constraints\Optional;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException; use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
/** /**

View File

@ -14,7 +14,6 @@ namespace Symfony\Component\Validator\Constraints;
use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\ConstraintValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException; use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Constraints\Optional;
/** /**
* @author Bernhard Schussek <bschussek@gmail.com> * @author Bernhard Schussek <bschussek@gmail.com>

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Constraints\EqualTo; use Symfony\Component\Validator\Constraints\EqualTo;
use Symfony\Component\Validator\Constraints\EqualToValidator; use Symfony\Component\Validator\Constraints\EqualToValidator;
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
/** /**
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Constraints\IdenticalTo; use Symfony\Component\Validator\Constraints\IdenticalTo;
use Symfony\Component\Validator\Constraints\IdenticalToValidator; use Symfony\Component\Validator\Constraints\IdenticalToValidator;
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
/** /**
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Constraints\NotEqualTo; use Symfony\Component\Validator\Constraints\NotEqualTo;
use Symfony\Component\Validator\Constraints\NotEqualToValidator; use Symfony\Component\Validator\Constraints\NotEqualToValidator;
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
/** /**
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>

View File

@ -13,7 +13,6 @@ namespace Symfony\Component\Validator\Tests\Constraints;
use Symfony\Component\Validator\Constraints\NotIdenticalTo; use Symfony\Component\Validator\Constraints\NotIdenticalTo;
use Symfony\Component\Validator\Constraints\NotIdenticalToValidator; use Symfony\Component\Validator\Constraints\NotIdenticalToValidator;
use Symfony\Component\Validator\Tests\Constraints\AbstractComparisonValidatorTestCase;
/** /**
* @author Daniel Holmes <daniel@danielholmes.org> * @author Daniel Holmes <daniel@danielholmes.org>

View File

@ -11,8 +11,6 @@
namespace Symfony\Component\Validator; namespace Symfony\Component\Validator;
use Symfony\Component\Validator\Constraint;
/** /**
* Validates values and graphs of objects and arrays. * Validates values and graphs of objects and arrays.
* *