mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-30 22:18:46 +02:00
Updating Symfony lib and dependencies:
Package operations: 2 installs, 23 updates, 0 removals - Updating psr/log (1.1.0 => 1.1.2) - Updating symfony/debug (v3.4.30 => v3.4.35) - Updating symfony/console (v3.4.30 => v3.4.35) - Updating symfony/dotenv (v3.4.30 => v3.4.35) - Updating symfony/routing (v3.4.30 => v3.4.35) - Updating symfony/finder (v3.4.30 => v3.4.35) - Updating symfony/filesystem (v3.4.30 => v3.4.35) - Installing symfony/polyfill-util (v1.12.0) - Installing symfony/polyfill-php56 (v1.12.0) - Updating symfony/http-foundation (v3.4.30 => v3.4.35) - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35) - Updating symfony/http-kernel (v3.4.30 => v3.4.35) - Updating symfony/config (v3.4.30 => v3.4.35) - Updating symfony/dependency-injection (v3.4.30 => v3.4.35) - Updating symfony/class-loader (v3.4.30 => v3.4.35) - Updating symfony/cache (v3.4.30 => v3.4.35) - Updating symfony/framework-bundle (v3.4.30 => v3.4.35) - Updating twig/twig (v1.42.2 => v1.42.4) - Updating symfony/twig-bridge (v3.4.30 => v3.4.35) - Updating symfony/twig-bundle (v3.4.30 => v3.4.35) - Updating symfony/yaml (v3.4.30 => v3.4.35) - Updating symfony/stopwatch (v3.4.30 => v3.4.35) - Updating symfony/var-dumper (v3.4.30 => v3.4.35) - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35) - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
@@ -19,17 +19,17 @@ CHANGELOG
|
||||
* Deprecated the `KernelTestCase::getPhpUnitXmlDir()` and `KernelTestCase::getPhpUnitCliConfigArgument()` methods.
|
||||
* Deprecated `AddCacheClearerPass`, use tagged iterator arguments instead.
|
||||
* Deprecated `AddCacheWarmerPass`, use tagged iterator arguments instead.
|
||||
* Deprecated `TranslationDumperPass`, use
|
||||
* Deprecated `TranslationDumperPass`, use
|
||||
`Symfony\Component\Translation\DependencyInjection\TranslationDumperPass` instead
|
||||
* Deprecated `TranslationExtractorPass`, use
|
||||
* Deprecated `TranslationExtractorPass`, use
|
||||
`Symfony\Component\Translation\DependencyInjection\TranslationExtractorPass` instead
|
||||
* Deprecated `TranslatorPass`, use
|
||||
* Deprecated `TranslatorPass`, use
|
||||
`Symfony\Component\Translation\DependencyInjection\TranslatorPass` instead
|
||||
* Added `command` attribute to the `console.command` tag which takes the command
|
||||
name as value, using it makes the command lazy
|
||||
* Added `cache:pool:prune` command to allow manual stale cache item pruning of supported PSR-6 and PSR-16 cache pool
|
||||
implementations
|
||||
* Deprecated `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`, use
|
||||
* Deprecated `Symfony\Bundle\FrameworkBundle\Translation\TranslationLoader`, use
|
||||
`Symfony\Component\Translation\Reader\TranslationReader` instead
|
||||
* Deprecated `translation.loader` service, use `translation.reader` instead
|
||||
* `AssetsInstallCommand::__construct()` now takes an instance of
|
||||
|
||||
@@ -16,6 +16,7 @@ use Symfony\Component\Cache\Adapter\AdapterInterface;
|
||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||
use Symfony\Component\Cache\Adapter\PhpArrayAdapter;
|
||||
use Symfony\Component\Cache\Adapter\ProxyAdapter;
|
||||
use Symfony\Component\Config\Resource\ClassExistenceResource;
|
||||
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
|
||||
|
||||
/**
|
||||
@@ -54,13 +55,13 @@ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
||||
{
|
||||
$arrayAdapter = new ArrayAdapter();
|
||||
|
||||
spl_autoload_register([PhpArrayAdapter::class, 'throwOnRequiredClass']);
|
||||
spl_autoload_register([ClassExistenceResource::class, 'throwOnRequiredClass']);
|
||||
try {
|
||||
if (!$this->doWarmUp($cacheDir, $arrayAdapter)) {
|
||||
return;
|
||||
}
|
||||
} finally {
|
||||
spl_autoload_unregister([PhpArrayAdapter::class, 'throwOnRequiredClass']);
|
||||
spl_autoload_unregister([ClassExistenceResource::class, 'throwOnRequiredClass']);
|
||||
}
|
||||
|
||||
// the ArrayAdapter stores the values serialized
|
||||
@@ -83,8 +84,18 @@ abstract class AbstractPhpFileCacheWarmer implements CacheWarmerInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $cacheDir
|
||||
* @param ArrayAdapter $arrayAdapter
|
||||
* @internal
|
||||
*/
|
||||
final protected function ignoreAutoloadException($class, \Exception $exception)
|
||||
{
|
||||
try {
|
||||
ClassExistenceResource::throwOnRequiredClass($class, $exception);
|
||||
} catch (\ReflectionException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $cacheDir
|
||||
*
|
||||
* @return bool false if there is nothing to warm-up
|
||||
*/
|
||||
|
||||
@@ -31,10 +31,9 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
private $debug;
|
||||
|
||||
/**
|
||||
* @param Reader $annotationReader
|
||||
* @param string $phpArrayFile The PHP file where annotations are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered annotations are cached
|
||||
* @param bool $debug Run in debug mode
|
||||
* @param string $phpArrayFile The PHP file where annotations are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered annotations are cached
|
||||
* @param bool $debug Run in debug mode
|
||||
*/
|
||||
public function __construct(Reader $annotationReader, $phpArrayFile, CacheItemPoolInterface $fallbackPool, $excludeRegexp = null, $debug = false)
|
||||
{
|
||||
@@ -64,17 +63,8 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
}
|
||||
try {
|
||||
$this->readAllComponents($reader, $class);
|
||||
} catch (\ReflectionException $e) {
|
||||
// ignore failing reflection
|
||||
} catch (AnnotationException $e) {
|
||||
/*
|
||||
* Ignore any AnnotationException to not break the cache warming process if an Annotation is badly
|
||||
* configured or could not be found / read / etc.
|
||||
*
|
||||
* In particular cases, an Annotation in your code can be used and defined only for a specific
|
||||
* environment but is always added to the annotations.map file by some Symfony default behaviors,
|
||||
* and you always end up with a not found Annotation.
|
||||
*/
|
||||
} catch (\Exception $e) {
|
||||
$this->ignoreAutoloadException($class, $e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,14 +74,32 @@ class AnnotationsCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
private function readAllComponents(Reader $reader, $class)
|
||||
{
|
||||
$reflectionClass = new \ReflectionClass($class);
|
||||
$reader->getClassAnnotations($reflectionClass);
|
||||
|
||||
try {
|
||||
$reader->getClassAnnotations($reflectionClass);
|
||||
} catch (AnnotationException $e) {
|
||||
/*
|
||||
* Ignore any AnnotationException to not break the cache warming process if an Annotation is badly
|
||||
* configured or could not be found / read / etc.
|
||||
*
|
||||
* In particular cases, an Annotation in your code can be used and defined only for a specific
|
||||
* environment but is always added to the annotations.map file by some Symfony default behaviors,
|
||||
* and you always end up with a not found Annotation.
|
||||
*/
|
||||
}
|
||||
|
||||
foreach ($reflectionClass->getMethods() as $reflectionMethod) {
|
||||
$reader->getMethodAnnotations($reflectionMethod);
|
||||
try {
|
||||
$reader->getMethodAnnotations($reflectionMethod);
|
||||
} catch (AnnotationException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
|
||||
$reader->getPropertyAnnotations($reflectionProperty);
|
||||
try {
|
||||
$reader->getPropertyAnnotations($reflectionProperty);
|
||||
} catch (AnnotationException $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,10 +56,10 @@ class SerializerCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
foreach ($loader->getMappedClasses() as $mappedClass) {
|
||||
try {
|
||||
$metadataFactory->getMetadataFor($mappedClass);
|
||||
} catch (\ReflectionException $e) {
|
||||
// ignore failing reflection
|
||||
} catch (AnnotationException $e) {
|
||||
// ignore failing annotations
|
||||
} catch (\Exception $e) {
|
||||
$this->ignoreAutoloadException($mappedClass, $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,8 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
private $validatorBuilder;
|
||||
|
||||
/**
|
||||
* @param ValidatorBuilderInterface $validatorBuilder
|
||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
||||
* @param string $phpArrayFile The PHP file where metadata are cached
|
||||
* @param CacheItemPoolInterface $fallbackPool The pool where runtime-discovered metadata are cached
|
||||
*/
|
||||
public function __construct(ValidatorBuilderInterface $validatorBuilder, $phpArrayFile, CacheItemPoolInterface $fallbackPool)
|
||||
{
|
||||
@@ -61,10 +60,10 @@ class ValidatorCacheWarmer extends AbstractPhpFileCacheWarmer
|
||||
if ($metadataFactory->hasMetadataFor($mappedClass)) {
|
||||
$metadataFactory->getMetadataFor($mappedClass);
|
||||
}
|
||||
} catch (\ReflectionException $e) {
|
||||
// ignore failing reflection
|
||||
} catch (AnnotationException $e) {
|
||||
// ignore failing annotations
|
||||
} catch (\Exception $e) {
|
||||
$this->ignoreAutoloadException($mappedClass, $e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ EOT
|
||||
|
||||
private static function isExpired($date)
|
||||
{
|
||||
$date = \DateTime::createFromFormat('m/Y', $date);
|
||||
$date = \DateTime::createFromFormat('d/m/Y', '01/'.$date);
|
||||
|
||||
return false !== $date && new \DateTime() > $date->modify('last day of this month 23:59:59');
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\Command;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
use Symfony\Component\Console\Exception\LogicException;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\StyleInterface;
|
||||
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
|
||||
@@ -26,6 +27,9 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
|
||||
*/
|
||||
abstract class AbstractConfigCommand extends ContainerDebugCommand
|
||||
{
|
||||
/**
|
||||
* @param OutputInterface|StyleInterface $output
|
||||
*/
|
||||
protected function listBundles($output)
|
||||
{
|
||||
$title = 'Available registered bundles with their extension alias if available';
|
||||
|
||||
@@ -42,7 +42,6 @@ class CacheClearCommand extends ContainerAwareCommand
|
||||
|
||||
/**
|
||||
* @param CacheClearerInterface $cacheClearer
|
||||
* @param Filesystem|null $filesystem
|
||||
*/
|
||||
public function __construct($cacheClearer = null, Filesystem $filesystem = null)
|
||||
{
|
||||
@@ -267,10 +266,9 @@ EOF
|
||||
}
|
||||
|
||||
/**
|
||||
* @param KernelInterface $parent
|
||||
* @param string $namespace
|
||||
* @param string $parentClass
|
||||
* @param string $warmupDir
|
||||
* @param string $namespace
|
||||
* @param string $parentClass
|
||||
* @param string $warmupDir
|
||||
*
|
||||
* @return KernelInterface
|
||||
*/
|
||||
|
||||
@@ -104,7 +104,7 @@ EOF
|
||||
} catch (LogicException $e) {
|
||||
$errorIo->error($e->getMessage());
|
||||
|
||||
return;
|
||||
return 1;
|
||||
}
|
||||
|
||||
$io->title(sprintf('Current configuration for "%s.%s"', $extensionAlias, $path));
|
||||
|
||||
@@ -86,7 +86,7 @@ EOF
|
||||
'For dumping a specific option, add its path as the second argument of this command. (e.g. <comment>config:dump-reference FrameworkBundle profiler.matcher</comment> to dump the <comment>framework.profiler.matcher</comment> configuration)',
|
||||
]);
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$extension = $this->findExtension($name);
|
||||
@@ -129,5 +129,7 @@ EOF
|
||||
}
|
||||
|
||||
$io->writeln(null === $path ? $dumper->dump($configuration, $extension->getNamespace()) : $dumper->dumpAtPath($configuration, $path));
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,5 +93,7 @@ EOF
|
||||
}
|
||||
|
||||
$io->table([], $tableRows);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,10 +154,13 @@ EOF
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return callable|null
|
||||
*/
|
||||
private function extractCallable(Route $route)
|
||||
{
|
||||
if (!$route->hasDefault('_controller')) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$controller = $route->getDefault('_controller');
|
||||
@@ -178,5 +181,7 @@ EOF
|
||||
return $controller;
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,5 +149,7 @@ EOF
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ EOF
|
||||
if (!\count($operation->getDomains())) {
|
||||
$errorIo->warning('No translation messages were found.');
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$resultMessage = 'Translation files were successfully updated';
|
||||
@@ -307,6 +307,8 @@ EOF
|
||||
}
|
||||
|
||||
$errorIo->success($resultMessage.'.');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function filterCatalogue(MessageCatalogue $catalogue, $domain)
|
||||
|
||||
@@ -127,8 +127,6 @@ abstract class Descriptor implements DescriptorInterface
|
||||
* * name: name of described service
|
||||
*
|
||||
* @param Definition|Alias|object $service
|
||||
* @param array $options
|
||||
* @param ContainerBuilder|null $builder
|
||||
*/
|
||||
abstract protected function describeContainerService($service, array $options = [], ContainerBuilder $builder = null);
|
||||
|
||||
@@ -166,8 +164,7 @@ abstract class Descriptor implements DescriptorInterface
|
||||
/**
|
||||
* Describes a callable.
|
||||
*
|
||||
* @param callable $callable
|
||||
* @param array $options
|
||||
* @param mixed $callable
|
||||
*/
|
||||
abstract protected function describeCallable($callable, array $options = []);
|
||||
|
||||
@@ -214,8 +211,7 @@ abstract class Descriptor implements DescriptorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $builder
|
||||
* @param string $serviceId
|
||||
* @param string $serviceId
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -235,8 +231,7 @@ abstract class Descriptor implements DescriptorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $builder
|
||||
* @param bool $showPrivate
|
||||
* @param bool $showPrivate
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -142,7 +142,9 @@ class JsonDescriptor extends Descriptor
|
||||
protected function describeContainerAlias(Alias $alias, array $options = [], ContainerBuilder $builder = null)
|
||||
{
|
||||
if (!$builder) {
|
||||
return $this->writeData($this->getContainerAliasData($alias), $options);
|
||||
$this->writeData($this->getContainerAliasData($alias), $options);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->writeData(
|
||||
@@ -179,8 +181,6 @@ class JsonDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* Writes data as json.
|
||||
*
|
||||
* @return array|string
|
||||
*/
|
||||
private function writeData(array $data, array $options)
|
||||
{
|
||||
@@ -209,8 +209,7 @@ class JsonDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Definition $definition
|
||||
* @param bool $omitTags
|
||||
* @param bool $omitTags
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -287,8 +286,7 @@ class JsonDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param string|null $event
|
||||
* @param string|null $event
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -320,7 +318,6 @@ class JsonDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* @param callable $callable
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@@ -249,7 +249,9 @@ class MarkdownDescriptor extends Descriptor
|
||||
."\n".'- Public: '.($alias->isPublic() && !$alias->isPrivate() ? 'yes' : 'no');
|
||||
|
||||
if (!isset($options['id'])) {
|
||||
return $this->write($output);
|
||||
$this->write($output);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->write(sprintf("### %s\n\n%s\n", $options['id'], $output));
|
||||
|
||||
@@ -369,7 +369,7 @@ class TextDescriptor extends Descriptor
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
|
||||
$this->describeContainerDefinition($builder->getDefinition((string) $alias), array_merge($options, ['id' => (string) $alias]));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -425,7 +425,6 @@ class TextDescriptor extends Descriptor
|
||||
$tableHeaders = ['Order', 'Callable', 'Priority'];
|
||||
$tableRows = [];
|
||||
|
||||
$order = 1;
|
||||
foreach ($eventListeners as $order => $listener) {
|
||||
$tableRows[] = [sprintf('#%d', $order + 1), $this->formatCallable($listener), $eventDispatcher->getListenerPriority($event, $listener)];
|
||||
}
|
||||
@@ -434,8 +433,6 @@ class TextDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $config
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function formatRouterConfig(array $config)
|
||||
@@ -494,7 +491,6 @@ class TextDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
* @param array $options
|
||||
*/
|
||||
private function writeText($content, array $options = [])
|
||||
{
|
||||
|
||||
@@ -98,7 +98,9 @@ class XmlDescriptor extends Descriptor
|
||||
$dom->appendChild($dom->importNode($this->getContainerAliasDocument($alias, isset($options['id']) ? $options['id'] : null)->childNodes->item(0), true));
|
||||
|
||||
if (!$builder) {
|
||||
return $this->writeDocument($dom);
|
||||
$this->writeDocument($dom);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$dom->appendChild($dom->importNode($this->getContainerDefinitionDocument($builder->getDefinition((string) $alias), (string) $alias)->childNodes->item(0), true));
|
||||
@@ -132,8 +134,6 @@ class XmlDescriptor extends Descriptor
|
||||
|
||||
/**
|
||||
* Writes DOM document.
|
||||
*
|
||||
* @return \DOMDocument|string
|
||||
*/
|
||||
private function writeDocument(\DOMDocument $dom)
|
||||
{
|
||||
@@ -158,7 +158,6 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Route $route
|
||||
* @param string|null $name
|
||||
*
|
||||
* @return \DOMDocument
|
||||
@@ -244,8 +243,7 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $builder
|
||||
* @param bool $showPrivate
|
||||
* @param bool $showPrivate
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
@@ -268,10 +266,9 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $service
|
||||
* @param string $id
|
||||
* @param ContainerBuilder|null $builder
|
||||
* @param bool $showArguments
|
||||
* @param mixed $service
|
||||
* @param string $id
|
||||
* @param bool $showArguments
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
@@ -296,11 +293,10 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $builder
|
||||
* @param string|null $tag
|
||||
* @param bool $showPrivate
|
||||
* @param bool $showArguments
|
||||
* @param callable $filter
|
||||
* @param string|null $tag
|
||||
* @param bool $showPrivate
|
||||
* @param bool $showArguments
|
||||
* @param callable $filter
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
@@ -330,7 +326,6 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Definition $definition
|
||||
* @param string|null $id
|
||||
* @param bool $omitTags
|
||||
*
|
||||
@@ -454,7 +449,6 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Alias $alias
|
||||
* @param string|null $id
|
||||
*
|
||||
* @return \DOMDocument
|
||||
@@ -492,8 +486,7 @@ class XmlDescriptor extends Descriptor
|
||||
}
|
||||
|
||||
/**
|
||||
* @param EventDispatcherInterface $eventDispatcher
|
||||
* @param string|null $event
|
||||
* @param string|null $event
|
||||
*
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
|
||||
@@ -431,7 +431,7 @@ trait ControllerTrait
|
||||
/**
|
||||
* Get a user from the Security Token Storage.
|
||||
*
|
||||
* @return mixed
|
||||
* @return object|null
|
||||
*
|
||||
* @throws \LogicException If SecurityBundle is not available
|
||||
*
|
||||
@@ -446,12 +446,12 @@ trait ControllerTrait
|
||||
}
|
||||
|
||||
if (null === $token = $this->container->get('security.token_storage')->getToken()) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!\is_object($user = $token->getUser())) {
|
||||
// e.g. anonymous authentication
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
||||
@@ -264,7 +264,7 @@ class Configuration implements ConfigurationInterface
|
||||
->canBeEnabled()
|
||||
->beforeNormalization()
|
||||
->always(function ($v) {
|
||||
if (true === $v['enabled']) {
|
||||
if (\is_array($v) && true === $v['enabled']) {
|
||||
$workflows = $v;
|
||||
unset($workflows['enabled']);
|
||||
|
||||
@@ -470,12 +470,6 @@ class Configuration implements ConfigurationInterface
|
||||
$rootNode
|
||||
->children()
|
||||
->arrayNode('session')
|
||||
->validate()
|
||||
->ifTrue(function ($v) {
|
||||
return empty($v['handler_id']) && !empty($v['save_path']);
|
||||
})
|
||||
->thenInvalid('Session save path is ignored without a handler service')
|
||||
->end()
|
||||
->info('session configuration')
|
||||
->canBeEnabled()
|
||||
->children()
|
||||
@@ -504,7 +498,7 @@ class Configuration implements ConfigurationInterface
|
||||
->defaultTrue()
|
||||
->setDeprecated('The "%path%.%node%" option is enabled by default and deprecated since Symfony 3.4. It will be always enabled in 4.0.')
|
||||
->end()
|
||||
->scalarNode('save_path')->end()
|
||||
->scalarNode('save_path')->defaultValue('%kernel.cache_dir%/sessions')->end()
|
||||
->integerNode('metadata_update_threshold')
|
||||
->defaultValue('0')
|
||||
->info('seconds to wait between 2 session metadata updates')
|
||||
@@ -935,7 +929,11 @@ class Configuration implements ConfigurationInterface
|
||||
->ifString()->then(function ($v) { return ['enabled' => true, 'resources' => $v]; })
|
||||
->end()
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return \is_array($v) && !isset($v['resources']); })
|
||||
->ifTrue(function ($v) { return \is_array($v) && !isset($v['enabled']); })
|
||||
->then(function ($v) { return $v + ['enabled' => true]; })
|
||||
->end()
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return \is_array($v) && !isset($v['resources']) && !isset($v['resource']); })
|
||||
->then(function ($v) {
|
||||
$e = $v['enabled'];
|
||||
unset($v['enabled']);
|
||||
@@ -954,7 +952,19 @@ class Configuration implements ConfigurationInterface
|
||||
->end()
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return \is_array($v) && array_keys($v) === range(0, \count($v) - 1); })
|
||||
->then(function ($v) { return ['default' => $v]; })
|
||||
->then(function ($v) {
|
||||
$resources = [];
|
||||
foreach ($v as $resource) {
|
||||
$resources = array_merge_recursive(
|
||||
$resources,
|
||||
\is_array($resource) && isset($resource['name'])
|
||||
? [$resource['name'] => $resource['value']]
|
||||
: ['default' => $resource]
|
||||
);
|
||||
}
|
||||
|
||||
return $resources;
|
||||
})
|
||||
->end()
|
||||
->prototype('array')
|
||||
->beforeNormalization()->ifString()->then(function ($v) { return [$v]; })->end()
|
||||
|
||||
@@ -234,7 +234,7 @@ class FrameworkExtension extends Extension
|
||||
|
||||
if ($this->isConfigEnabled($container, $config['session'])) {
|
||||
if (!\extension_loaded('session')) {
|
||||
throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://www.php.net/session.installation for instructions.');
|
||||
throw new LogicException('Session support cannot be enabled as the session extension is not installed. See https://php.net/session.installation for instructions.');
|
||||
}
|
||||
|
||||
$this->sessionConfigEnabled = true;
|
||||
@@ -877,11 +877,6 @@ class FrameworkExtension extends Extension
|
||||
|
||||
// session handler (the internal callback registered with PHP session management)
|
||||
if (null === $config['handler_id']) {
|
||||
// If the user set a save_path without using a non-default \SessionHandler, it will silently be ignored
|
||||
if (isset($config['save_path'])) {
|
||||
throw new LogicException('Session save path is ignored without a handler service');
|
||||
}
|
||||
|
||||
// Set the handler class to be null
|
||||
$container->getDefinition('session.storage.native')->replaceArgument(1, null);
|
||||
$container->getDefinition('session.storage.php_bridge')->replaceArgument(0, null);
|
||||
@@ -889,10 +884,6 @@ class FrameworkExtension extends Extension
|
||||
$container->setAlias('session.handler', $config['handler_id'])->setPrivate(true);
|
||||
}
|
||||
|
||||
if (!isset($config['save_path'])) {
|
||||
$config['save_path'] = ini_get('session.save_path');
|
||||
}
|
||||
|
||||
$container->setParameter('session.save_path', $config['save_path']);
|
||||
|
||||
if (\PHP_VERSION_ID < 70000) {
|
||||
@@ -1052,8 +1043,6 @@ class FrameworkExtension extends Extension
|
||||
$container->getDefinition('assets.url_package')->setPrivate(true);
|
||||
$container->getDefinition('assets.static_version_strategy')->setPrivate(true);
|
||||
|
||||
$defaultVersion = null;
|
||||
|
||||
if ($config['version_strategy']) {
|
||||
$defaultVersion = new Reference($config['version_strategy']);
|
||||
} else {
|
||||
@@ -1752,9 +1741,7 @@ class FrameworkExtension extends Extension
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the base path for the XSD files.
|
||||
*
|
||||
* @return string The XSD base path
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getXsdValidationBasePath()
|
||||
{
|
||||
|
||||
@@ -34,10 +34,6 @@ class SessionListener extends AbstractSessionListener
|
||||
|
||||
protected function getSession()
|
||||
{
|
||||
if (!$this->container->has('session')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->container->get('session');
|
||||
return $this->container->get('session', ContainerInterface::NULL_ON_INVALID_REFERENCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,10 +34,6 @@ class TestSessionListener extends AbstractTestSessionListener
|
||||
|
||||
protected function getSession()
|
||||
{
|
||||
if (!$this->container->has('session')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $this->container->get('session');
|
||||
return $this->container->get('session', ContainerInterface::NULL_ON_INVALID_REFERENCE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ trait MicroKernelTrait
|
||||
*
|
||||
* $routes->import('config/routing.yml');
|
||||
* $routes->add('/admin', 'AppBundle:Admin:dashboard', 'admin_dashboard');
|
||||
*
|
||||
* @param RouteCollectionBuilder $routes
|
||||
*/
|
||||
abstract protected function configureRoutes(RouteCollectionBuilder $routes);
|
||||
|
||||
@@ -50,9 +48,6 @@ trait MicroKernelTrait
|
||||
* Or parameters:
|
||||
*
|
||||
* $c->setParameter('halloween', 'lot of fun');
|
||||
*
|
||||
* @param ContainerBuilder $c
|
||||
* @param LoaderInterface $loader
|
||||
*/
|
||||
abstract protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<argument type="service" id="annotations.reader" />
|
||||
<argument>%kernel.cache_dir%/annotations.php</argument>
|
||||
<argument type="service" id="cache.annotations" />
|
||||
<argument>#^Symfony\\(?:Component\\HttpKernel\\|Bundle\\FrameworkBundle\\Controller\\(?!AbstractController$|Controller$))#</argument>
|
||||
<argument>#^Symfony\\(?:Component\\HttpKernel\\|Bundle\\FrameworkBundle\\Controller\\(?!.*Controller$))#</argument>
|
||||
<argument>%kernel.debug%</argument>
|
||||
</service>
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
||||
return '%%';
|
||||
}
|
||||
|
||||
if (preg_match('/^env\(\w+\)$/', $match[1])) {
|
||||
if (preg_match('/^env\((?:\w++:)*+\w++\)$/', $match[1])) {
|
||||
throw new RuntimeException(sprintf('Using "%%%s%%" is not allowed in routing configuration.', $match[1]));
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ class Router extends BaseRouter implements WarmableInterface, ServiceSubscriberI
|
||||
if (\is_string($resolved) || is_numeric($resolved)) {
|
||||
$this->collectedParameters[$match[1]] = $resolved;
|
||||
|
||||
return (string) $resolved;
|
||||
return (string) $this->resolve($resolved);
|
||||
}
|
||||
|
||||
throw new RuntimeException(sprintf('The container parameter "%s", used in the route configuration value "%s", must be a string or numeric, but it is of type %s.', $match[1], $value, \gettype($resolved)));
|
||||
|
||||
@@ -36,7 +36,7 @@ class GlobalVariables
|
||||
public function getToken()
|
||||
{
|
||||
if (!$this->container->has('security.token_storage')) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->container->get('security.token_storage')->getToken();
|
||||
@@ -45,15 +45,12 @@ class GlobalVariables
|
||||
public function getUser()
|
||||
{
|
||||
if (!$token = $this->getToken()) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
$user = $token->getUser();
|
||||
if (!\is_object($user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
return $user;
|
||||
return \is_object($user) ? $user : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,9 +58,7 @@ class GlobalVariables
|
||||
*/
|
||||
public function getRequest()
|
||||
{
|
||||
if ($this->container->has('request_stack')) {
|
||||
return $this->container->get('request_stack')->getCurrentRequest();
|
||||
}
|
||||
return $this->container->has('request_stack') ? $this->container->get('request_stack')->getCurrentRequest() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,9 +66,7 @@ class GlobalVariables
|
||||
*/
|
||||
public function getSession()
|
||||
{
|
||||
if ($request = $this->getRequest()) {
|
||||
return $request->getSession();
|
||||
}
|
||||
return ($request = $this->getRequest()) ? $request->getSession() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -110,7 +110,7 @@ class CodeHelper extends Helper
|
||||
* @param string $file A file path
|
||||
* @param int $line The selected line number
|
||||
*
|
||||
* @return string An HTML string
|
||||
* @return string|null An HTML string
|
||||
*/
|
||||
public function fileExcerpt($file, $line)
|
||||
{
|
||||
@@ -120,12 +120,12 @@ class CodeHelper extends Helper
|
||||
|
||||
// Check if the file is an application/octet-stream (eg. Phar file) because highlight_file cannot parse these files
|
||||
if ('application/octet-stream' === $finfo->file($file, FILEINFO_MIME_TYPE)) {
|
||||
return;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
// highlight_file could throw warnings
|
||||
// see https://bugs.php.net/bug.php?id=25725
|
||||
// see https://bugs.php.net/25725
|
||||
$code = @highlight_file($file, true);
|
||||
// remove main code/span tags
|
||||
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
|
||||
@@ -138,6 +138,8 @@ class CodeHelper extends Helper
|
||||
|
||||
return '<ol start="'.max($line - 3, 1).'">'.implode("\n", $lines).'</ol>';
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,12 +35,14 @@ class StopwatchHelper extends Helper
|
||||
|
||||
public function __call($method, $arguments = [])
|
||||
{
|
||||
if (null !== $this->stopwatch) {
|
||||
if (method_exists($this->stopwatch, $method)) {
|
||||
return \call_user_func_array([$this->stopwatch, $method], $arguments);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
||||
if (null === $this->stopwatch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (method_exists($this->stopwatch, $method)) {
|
||||
return \call_user_func_array([$this->stopwatch, $method], $arguments);
|
||||
}
|
||||
|
||||
throw new \BadMethodCallException(sprintf('Method "%s" of Stopwatch does not exist', $method));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<?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\Bundle\FrameworkBundle\Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
// Auto-adapt to PHPUnit 8 that added a `void` return-type to the tearDown method
|
||||
|
||||
if (method_exists(\ReflectionMethod::class, 'hasReturnType') && (new \ReflectionMethod(TestCase::class, 'tearDown'))->hasReturnType()) {
|
||||
eval('
|
||||
namespace Symfony\Bundle\FrameworkBundle\Test;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
trait KernelShutdownOnTearDownTrait
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
static::ensureKernelShutdown();
|
||||
}
|
||||
}
|
||||
');
|
||||
} else {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
trait KernelShutdownOnTearDownTrait
|
||||
{
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
static::ensureKernelShutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ use Symfony\Component\HttpKernel\KernelInterface;
|
||||
*/
|
||||
abstract class KernelTestCase extends TestCase
|
||||
{
|
||||
use KernelShutdownOnTearDownTrait;
|
||||
use ForwardCompatTestTrait;
|
||||
|
||||
protected static $class;
|
||||
|
||||
@@ -32,6 +32,12 @@ abstract class KernelTestCase extends TestCase
|
||||
*/
|
||||
protected static $kernel;
|
||||
|
||||
private function doTearDown()
|
||||
{
|
||||
static::ensureKernelShutdown();
|
||||
static::$kernel = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the directory where the phpunit.xml(.dist) is stored.
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\Common\Annotations\CachedReader;
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Bundle\FrameworkBundle\CacheWarmer\AnnotationsCacheWarmer;
|
||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||
@@ -86,7 +87,55 @@ class AnnotationsCacheWarmerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|Reader
|
||||
* Test that the cache warming process is not broken if a class loader
|
||||
* throws an exception (on class / file not found for example).
|
||||
*/
|
||||
public function testClassAutoloadException()
|
||||
{
|
||||
$this->assertFalse(class_exists($annotatedClass = 'C\C\C', false));
|
||||
|
||||
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export([$annotatedClass], true)));
|
||||
$warmer = new AnnotationsCacheWarmer(new AnnotationReader(), tempnam($this->cacheDir, __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classLoader = function ($class) use ($annotatedClass) {
|
||||
if ($class === $annotatedClass) {
|
||||
throw new \DomainException('This exception should be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp($this->cacheDir);
|
||||
|
||||
spl_autoload_unregister($classLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the cache warming process is broken if a class loader throws an
|
||||
* exception but that is unrelated to the class load.
|
||||
*/
|
||||
public function testClassAutoloadExceptionWithUnrelatedException()
|
||||
{
|
||||
$this->expectException(\DomainException::class);
|
||||
$this->expectExceptionMessage('This exception should not be caught by the warmer.');
|
||||
|
||||
$this->assertFalse(class_exists($annotatedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_AnnotationsCacheWarmerTest', false));
|
||||
|
||||
file_put_contents($this->cacheDir.'/annotations.map', sprintf('<?php return %s;', var_export([$annotatedClass], true)));
|
||||
$warmer = new AnnotationsCacheWarmer(new AnnotationReader(), tempnam($this->cacheDir, __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classLoader = function ($class) use ($annotatedClass) {
|
||||
if ($class === $annotatedClass) {
|
||||
eval('class '.$annotatedClass.'{}');
|
||||
throw new \DomainException('This exception should not be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp($this->cacheDir);
|
||||
|
||||
spl_autoload_unregister($classLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MockObject|Reader
|
||||
*/
|
||||
private function getReadOnlyReader()
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ class SerializerCacheWarmerTest extends TestCase
|
||||
|
||||
$values = $fallbackPool->getValues();
|
||||
|
||||
$this->assertInternalType('array', $values);
|
||||
$this->assertIsArray($values);
|
||||
$this->assertCount(2, $values);
|
||||
$this->assertArrayHasKey('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person', $values);
|
||||
$this->assertArrayHasKey('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author', $values);
|
||||
@@ -74,7 +74,61 @@ class SerializerCacheWarmerTest extends TestCase
|
||||
|
||||
$values = $fallbackPool->getValues();
|
||||
|
||||
$this->assertInternalType('array', $values);
|
||||
$this->assertIsArray($values);
|
||||
$this->assertCount(0, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the cache warming process is not broken if a class loader
|
||||
* throws an exception (on class / file not found for example).
|
||||
*/
|
||||
public function testClassAutoloadException()
|
||||
{
|
||||
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
|
||||
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
|
||||
}
|
||||
|
||||
$this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest', false));
|
||||
|
||||
$warmer = new SerializerCacheWarmer([new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/does_not_exist.yaml')], tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classLoader = function ($class) use ($mappedClass) {
|
||||
if ($class === $mappedClass) {
|
||||
throw new \DomainException('This exception should be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp('foo');
|
||||
|
||||
spl_autoload_unregister($classLoader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the cache warming process is broken if a class loader throws an
|
||||
* exception but that is unrelated to the class load.
|
||||
*/
|
||||
public function testClassAutoloadExceptionWithUnrelatedException()
|
||||
{
|
||||
$this->expectException(\DomainException::class);
|
||||
$this->expectExceptionMessage('This exception should not be caught by the warmer.');
|
||||
|
||||
if (!class_exists(CacheClassMetadataFactory::class) || !method_exists(XmlFileLoader::class, 'getMappedClasses') || !method_exists(YamlFileLoader::class, 'getMappedClasses')) {
|
||||
$this->markTestSkipped('The Serializer default cache warmer has been introduced in the Serializer Component version 3.2.');
|
||||
}
|
||||
|
||||
$this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_SerializerCacheWarmerTest', false));
|
||||
|
||||
$warmer = new SerializerCacheWarmer([new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/does_not_exist.yaml')], tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classLoader = function ($class) use ($mappedClass) {
|
||||
if ($class === $mappedClass) {
|
||||
eval('class '.$mappedClass.'{}');
|
||||
throw new \DomainException('This exception should not be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp('foo');
|
||||
|
||||
spl_autoload_unregister($classLoader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class ValidatorCacheWarmerTest extends TestCase
|
||||
|
||||
$values = $fallbackPool->getValues();
|
||||
|
||||
$this->assertInternalType('array', $values);
|
||||
$this->assertIsArray($values);
|
||||
$this->assertCount(2, $values);
|
||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Person', $values);
|
||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author', $values);
|
||||
@@ -77,7 +77,7 @@ class ValidatorCacheWarmerTest extends TestCase
|
||||
|
||||
$values = $fallbackPool->getValues();
|
||||
|
||||
$this->assertInternalType('array', $values);
|
||||
$this->assertIsArray($values);
|
||||
$this->assertCount(2, $values);
|
||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Category', $values);
|
||||
$this->assertArrayHasKey('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.SubCategory', $values);
|
||||
@@ -99,7 +99,57 @@ class ValidatorCacheWarmerTest extends TestCase
|
||||
|
||||
$values = $fallbackPool->getValues();
|
||||
|
||||
$this->assertInternalType('array', $values);
|
||||
$this->assertIsArray($values);
|
||||
$this->assertCount(0, $values);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the cache warming process is not broken if a class loader
|
||||
* throws an exception (on class / file not found for example).
|
||||
*/
|
||||
public function testClassAutoloadException()
|
||||
{
|
||||
$this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_ValidatorCacheWarmerTest', false));
|
||||
|
||||
$validatorBuilder = new ValidatorBuilder();
|
||||
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/does_not_exist.yaml');
|
||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classloader = function ($class) use ($mappedClass) {
|
||||
if ($class === $mappedClass) {
|
||||
throw new \DomainException('This exception should be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp('foo');
|
||||
|
||||
spl_autoload_unregister($classloader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that the cache warming process is broken if a class loader throws an
|
||||
* exception but that is unrelated to the class load.
|
||||
*/
|
||||
public function testClassAutoloadExceptionWithUnrelatedException()
|
||||
{
|
||||
$this->expectException(\DomainException::class);
|
||||
$this->expectExceptionMessage('This exception should not be caught by the warmer.');
|
||||
|
||||
$this->assertFalse(class_exists($mappedClass = 'AClassThatDoesNotExist_FWB_CacheWarmer_ValidatorCacheWarmerTest', false));
|
||||
|
||||
$validatorBuilder = new ValidatorBuilder();
|
||||
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/does_not_exist.yaml');
|
||||
$warmer = new ValidatorCacheWarmer($validatorBuilder, tempnam(sys_get_temp_dir(), __FUNCTION__), new ArrayAdapter());
|
||||
|
||||
spl_autoload_register($classLoader = function ($class) use ($mappedClass) {
|
||||
if ($class === $mappedClass) {
|
||||
eval('class '.$mappedClass.'{}');
|
||||
throw new \DomainException('This exception should not be caught by the warmer.');
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
$warmer->warmUp('foo');
|
||||
|
||||
spl_autoload_unregister($classLoader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Symfony\Bundle\FrameworkBundle\Command\CachePoolPruneCommand;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
|
||||
@@ -55,7 +56,7 @@ class CachePruneCommandTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|KernelInterface
|
||||
* @return MockObject|KernelInterface
|
||||
*/
|
||||
private function getKernel()
|
||||
{
|
||||
@@ -81,7 +82,7 @@ class CachePruneCommandTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \PHPUnit_Framework_MockObject_MockObject|PruneableInterface
|
||||
* @return MockObject|PruneableInterface
|
||||
*/
|
||||
private function getPruneableInterfaceMock()
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ class RouterDebugCommandTest extends TestCase
|
||||
$ret = $tester->execute(['name' => null], ['decorated' => false]);
|
||||
|
||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertContains('Name Method Scheme Host Path', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Name Method Scheme Host Path', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDebugSingleRoute()
|
||||
@@ -36,14 +36,12 @@ class RouterDebugCommandTest extends TestCase
|
||||
$ret = $tester->execute(['name' => 'foo'], ['decorated' => false]);
|
||||
|
||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertContains('Route Name | foo', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Route Name | foo', $tester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testDebugInvalidRoute()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->createCommandTester()->execute(['name' => 'test']);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ class RouterMatchCommandTest extends TestCase
|
||||
$ret = $tester->execute(['path_info' => '/foo', 'foo'], ['decorated' => false]);
|
||||
|
||||
$this->assertEquals(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertContains('Route Name | foo', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Route Name | foo', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testWithNotMatchPath()
|
||||
@@ -38,7 +38,7 @@ class RouterMatchCommandTest extends TestCase
|
||||
$ret = $tester->execute(['path_info' => '/test', 'foo'], ['decorated' => false]);
|
||||
|
||||
$this->assertEquals(1, $ret, 'Returns 1 in case of failure');
|
||||
$this->assertContains('None of the routes match the path "/test"', $tester->getDisplay());
|
||||
$this->assertStringContainsString('None of the routes match the path "/test"', $tester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,7 +56,7 @@ class RouterMatchCommandTest extends TestCase
|
||||
|
||||
$tester->execute(['path_info' => '/']);
|
||||
|
||||
$this->assertContains('None of the routes match the path "/"', $tester->getDisplay());
|
||||
$this->assertStringContainsString('None of the routes match the path "/"', $tester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -94,11 +94,9 @@ class TranslationDebugCommandTest extends TestCase
|
||||
$this->assertRegExp('/unused/', $tester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testDebugInvalidDirectory()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\KernelInterface')->getMock();
|
||||
$kernel->expects($this->once())
|
||||
->method('getBundle')
|
||||
@@ -241,7 +239,7 @@ class TranslationDebugCommandTest extends TestCase
|
||||
$tester = new CommandTester($application->find('debug:translation'));
|
||||
$tester->execute(['locale' => 'en']);
|
||||
|
||||
$this->assertContains('No defined or extracted', $tester->getDisplay());
|
||||
$this->assertStringContainsString('No defined or extracted', $tester->getDisplay());
|
||||
}
|
||||
|
||||
private function getBundle($path)
|
||||
|
||||
@@ -231,7 +231,7 @@ class TranslationUpdateCommandTest extends TestCase
|
||||
$tester = new CommandTester($application->find('translation:update'));
|
||||
$tester->execute(['locale' => 'en']);
|
||||
|
||||
$this->assertContains('You must choose one of --force or --dump-messages', $tester->getDisplay());
|
||||
$this->assertStringContainsString('You must choose one of --force or --dump-messages', $tester->getDisplay());
|
||||
}
|
||||
|
||||
private function getBundle($path)
|
||||
|
||||
@@ -41,7 +41,7 @@ class YamlLintCommandTest extends TestCase
|
||||
);
|
||||
|
||||
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
|
||||
$this->assertContains('OK', trim($tester->getDisplay()));
|
||||
$this->assertStringContainsString('OK', trim($tester->getDisplay()));
|
||||
}
|
||||
|
||||
public function testLintIncorrectFile()
|
||||
@@ -55,14 +55,12 @@ bar';
|
||||
$tester->execute(['filename' => $filename], ['decorated' => false]);
|
||||
|
||||
$this->assertEquals(1, $tester->getStatusCode(), 'Returns 1 in case of error');
|
||||
$this->assertContains('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
|
||||
$this->assertStringContainsString('Unable to parse at line 3 (near "bar").', trim($tester->getDisplay()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testLintFileNotReadable()
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$tester = $this->createCommandTester();
|
||||
$filename = $this->createFile('');
|
||||
unlink($filename);
|
||||
@@ -74,29 +72,12 @@ bar';
|
||||
{
|
||||
$command = new YamlLintCommand();
|
||||
$expected = <<<EOF
|
||||
The <info>%command.name%</info> command lints a YAML file and outputs to STDOUT
|
||||
the first encountered syntax error.
|
||||
|
||||
You can validates YAML contents passed from STDIN:
|
||||
|
||||
<info>cat filename | php %command.full_name%</info>
|
||||
|
||||
You can also validate the syntax of a file:
|
||||
|
||||
<info>php %command.full_name% filename</info>
|
||||
|
||||
Or of a whole directory:
|
||||
|
||||
<info>php %command.full_name% dirname</info>
|
||||
<info>php %command.full_name% dirname --format=json</info>
|
||||
|
||||
Or find all files in a bundle:
|
||||
|
||||
<info>php %command.full_name% @AcmeDemoBundle</info>
|
||||
|
||||
EOF;
|
||||
|
||||
$this->assertEquals($expected, $command->getHelp());
|
||||
$this->assertStringContainsString($expected, $command->getHelp());
|
||||
}
|
||||
|
||||
public function testLintFilesFromBundleDirectory()
|
||||
@@ -108,7 +89,7 @@ EOF;
|
||||
);
|
||||
|
||||
$this->assertEquals(0, $tester->getStatusCode(), 'Returns 0 in case of success');
|
||||
$this->assertContains('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay()));
|
||||
$this->assertStringContainsString('[OK] All 0 YAML files contain valid syntax', trim($tester->getDisplay()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -160,9 +160,9 @@ class ApplicationTest extends TestCase
|
||||
$output = $tester->getDisplay();
|
||||
|
||||
$this->assertSame(0, $tester->getStatusCode());
|
||||
$this->assertContains('Some commands could not be registered:', $output);
|
||||
$this->assertContains('throwing', $output);
|
||||
$this->assertContains('fine', $output);
|
||||
$this->assertStringContainsString('Some commands could not be registered:', $output);
|
||||
$this->assertStringContainsString('throwing', $output);
|
||||
$this->assertStringContainsString('fine', $output);
|
||||
}
|
||||
|
||||
public function testRegistrationErrorsAreDisplayedOnCommandNotFound()
|
||||
@@ -188,8 +188,8 @@ class ApplicationTest extends TestCase
|
||||
$output = $tester->getDisplay();
|
||||
|
||||
$this->assertSame(1, $tester->getStatusCode());
|
||||
$this->assertContains('Some commands could not be registered:', $output);
|
||||
$this->assertContains('Command "fine" is not defined.', $output);
|
||||
$this->assertStringContainsString('Some commands could not be registered:', $output);
|
||||
$this->assertStringContainsString('Command "fine" is not defined.', $output);
|
||||
}
|
||||
|
||||
private function getKernel(array $bundles, $useDispatcher = false)
|
||||
|
||||
@@ -127,9 +127,9 @@ class ControllerNameParserTest extends TestCase
|
||||
|
||||
if (false === $suggestedBundleName) {
|
||||
// make sure we don't have a suggestion
|
||||
$this->assertNotContains('Did you mean', $e->getMessage());
|
||||
$this->assertStringNotContainsString('Did you mean', $e->getMessage());
|
||||
} else {
|
||||
$this->assertContains(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage());
|
||||
$this->assertStringContainsString(sprintf('Did you mean "%s"', $suggestedBundleName), $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,12 +87,10 @@ abstract class ControllerTraitTest extends TestCase
|
||||
$this->assertNull($controller->getUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage The SecurityBundle is not registered in your application.
|
||||
*/
|
||||
public function testGetUserWithEmptyContainer()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('The SecurityBundle is not registered in your application.');
|
||||
$controller = $this->createController();
|
||||
$controller->setContainer(new Container());
|
||||
|
||||
@@ -188,8 +186,8 @@ abstract class ControllerTraitTest extends TestCase
|
||||
if ($response->headers->get('content-type')) {
|
||||
$this->assertSame('text/x-php', $response->headers->get('content-type'));
|
||||
}
|
||||
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
|
||||
}
|
||||
|
||||
public function testFileAsInline()
|
||||
@@ -204,8 +202,8 @@ abstract class ControllerTraitTest extends TestCase
|
||||
if ($response->headers->get('content-type')) {
|
||||
$this->assertSame('text/x-php', $response->headers->get('content-type'));
|
||||
}
|
||||
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
|
||||
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
|
||||
}
|
||||
|
||||
public function testFileWithOwnFileName()
|
||||
@@ -221,8 +219,8 @@ abstract class ControllerTraitTest extends TestCase
|
||||
if ($response->headers->get('content-type')) {
|
||||
$this->assertSame('text/x-php', $response->headers->get('content-type'));
|
||||
}
|
||||
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertContains($fileName, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString($fileName, $response->headers->get('content-disposition'));
|
||||
}
|
||||
|
||||
public function testFileWithOwnFileNameAsInline()
|
||||
@@ -238,8 +236,8 @@ abstract class ControllerTraitTest extends TestCase
|
||||
if ($response->headers->get('content-type')) {
|
||||
$this->assertSame('text/x-php', $response->headers->get('content-type'));
|
||||
}
|
||||
$this->assertContains(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
|
||||
$this->assertContains($fileName, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_INLINE, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString($fileName, $response->headers->get('content-disposition'));
|
||||
}
|
||||
|
||||
public function testFileFromPath()
|
||||
@@ -254,8 +252,8 @@ abstract class ControllerTraitTest extends TestCase
|
||||
if ($response->headers->get('content-type')) {
|
||||
$this->assertSame('text/x-php', $response->headers->get('content-type'));
|
||||
}
|
||||
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertContains(basename(__FILE__), $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(basename(__FILE__), $response->headers->get('content-disposition'));
|
||||
}
|
||||
|
||||
public function testFileFromPathWithCustomizedFileName()
|
||||
@@ -270,19 +268,16 @@ abstract class ControllerTraitTest extends TestCase
|
||||
if ($response->headers->get('content-type')) {
|
||||
$this->assertSame('text/x-php', $response->headers->get('content-type'));
|
||||
}
|
||||
$this->assertContains(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertContains('test.php', $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $response->headers->get('content-disposition'));
|
||||
$this->assertStringContainsString('test.php', $response->headers->get('content-disposition'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException
|
||||
*/
|
||||
public function testFileWhichDoesNotExist()
|
||||
{
|
||||
$this->expectException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
|
||||
$controller = $this->createController();
|
||||
|
||||
/* @var BinaryFileResponse $response */
|
||||
$response = $controller->file('some-file.txt', 'test.php');
|
||||
$controller->file('some-file.txt', 'test.php');
|
||||
}
|
||||
|
||||
public function testIsGranted()
|
||||
@@ -299,11 +294,9 @@ abstract class ControllerTraitTest extends TestCase
|
||||
$this->assertTrue($controller->isGranted('foo'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Security\Core\Exception\AccessDeniedException
|
||||
*/
|
||||
public function testdenyAccessUnlessGranted()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Security\Core\Exception\AccessDeniedException');
|
||||
$authorizationChecker = $this->getMockBuilder('Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface')->getMock();
|
||||
$authorizationChecker->expects($this->once())->method('isGranted')->willReturn(false);
|
||||
|
||||
@@ -431,10 +424,10 @@ abstract class ControllerTraitTest extends TestCase
|
||||
public function testRedirect()
|
||||
{
|
||||
$controller = $this->createController();
|
||||
$response = $controller->redirect('http://dunglas.fr', 301);
|
||||
$response = $controller->redirect('https://dunglas.fr', 301);
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\RedirectResponse', $response);
|
||||
$this->assertSame('http://dunglas.fr', $response->getTargetUrl());
|
||||
$this->assertSame('https://dunglas.fr', $response->getTargetUrl());
|
||||
$this->assertSame(301, $response->getStatusCode());
|
||||
}
|
||||
|
||||
|
||||
@@ -77,12 +77,10 @@ class TemplateControllerTest extends TestCase
|
||||
$this->assertEquals('bar', $controller->templateAction('mytemplate')->getContent());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.
|
||||
*/
|
||||
public function testNoTwigNorTemplating()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('You can not use the TemplateController if the Templating Component or the Twig Bundle are not available.');
|
||||
$controller = new TemplateController();
|
||||
|
||||
$controller->templateAction('mytemplate')->getContent();
|
||||
|
||||
@@ -63,12 +63,10 @@ class AddConsoleCommandPassTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The service "my-command" tagged "console.command" must not be abstract.
|
||||
*/
|
||||
public function testProcessThrowAnExceptionIfTheServiceIsAbstract()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The service "my-command" tagged "console.command" must not be abstract.');
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddConsoleCommandPass());
|
||||
|
||||
@@ -80,12 +78,10 @@ class AddConsoleCommandPassTest extends TestCase
|
||||
$container->compile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The service "my-command" tagged "console.command" must be a subclass of "Symfony\Component\Console\Command\Command".
|
||||
*/
|
||||
public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The service "my-command" tagged "console.command" must be a subclass of "Symfony\Component\Console\Command\Command".');
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new AddConsoleCommandPass());
|
||||
|
||||
|
||||
@@ -46,14 +46,12 @@ class AddConstraintValidatorsPassTest extends TestCase
|
||||
$this->assertEquals($expected, $container->getDefinition((string) $validatorFactory->getArgument(0)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.
|
||||
*/
|
||||
public function testAbstractConstraintValidator()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The service "my_abstract_constraint_validator" tagged "validator.constraint_validator" must not be abstract.');
|
||||
$container = new ContainerBuilder();
|
||||
$validatorFactory = $container->register('validator.validator_factory')
|
||||
$container->register('validator.validator_factory')
|
||||
->addArgument([]);
|
||||
|
||||
$container->register('my_abstract_constraint_validator')
|
||||
|
||||
@@ -93,12 +93,10 @@ class CachePoolPassTest extends TestCase
|
||||
$this->assertSame(3, $cachePool->getArgument(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Invalid "cache.pool" tag for service "app.cache_pool": accepted attributes are
|
||||
*/
|
||||
public function testThrowsExceptionWhenCachePoolTagHasUnknownAttributes()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Invalid "cache.pool" tag for service "app.cache_pool": accepted attributes are');
|
||||
$container = new ContainerBuilder();
|
||||
$container->setParameter('kernel.debug', false);
|
||||
$container->setParameter('kernel.name', 'app');
|
||||
|
||||
@@ -56,12 +56,10 @@ class CachePoolPrunerPassTest extends TestCase
|
||||
$this->assertCount($aliasesBefore, $container->getAliases());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage Class "Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\NotFound" used for service "pool.not-found" cannot be found.
|
||||
*/
|
||||
public function testCompilerPassThrowsOnInvalidDefinitionClass()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Class "Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler\NotFound" used for service "pool.not-found" cannot be found.');
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('console.command.cache_pool_prune')->addArgument([]);
|
||||
$container->register('pool.not-found', NotFound::class)->addTag('cache.pool');
|
||||
|
||||
@@ -124,12 +124,10 @@ class FormPassTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage extended-type attribute, none was configured for the "my.type_extension" service
|
||||
*/
|
||||
public function testAddTaggedFormTypeExtensionWithoutExtendedTypeAttribute()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('extended-type attribute, none was configured for the "my.type_extension" service');
|
||||
$container = new ContainerBuilder();
|
||||
$container->addCompilerPass(new FormPass());
|
||||
|
||||
|
||||
@@ -24,11 +24,10 @@ class ProfilerPassTest extends TestCase
|
||||
* Thus, a fully-valid tag looks something like this:
|
||||
*
|
||||
* <tag name="data_collector" template="YourBundle:Collector:templatename" id="your_collector_name" />
|
||||
*
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testTemplateNoIdThrowsException()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$builder = new ContainerBuilder();
|
||||
$builder->register('profiler', 'ProfilerClass');
|
||||
$builder->register('my_collector_service')
|
||||
|
||||
@@ -25,12 +25,10 @@ use Symfony\Component\DependencyInjection\Reference;
|
||||
*/
|
||||
class SerializerPassTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage You must tag at least one service as "serializer.normalizer" to use the "serializer" service
|
||||
*/
|
||||
public function testThrowExceptionWhenNoNormalizers()
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage('You must tag at least one service as "serializer.normalizer" to use the "serializer" service');
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('serializer');
|
||||
|
||||
@@ -38,12 +36,10 @@ class SerializerPassTest extends TestCase
|
||||
$serializerPass->process($container);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage You must tag at least one service as "serializer.encoder" to use the "serializer" service
|
||||
*/
|
||||
public function testThrowExceptionWhenNoEncoders()
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage('You must tag at least one service as "serializer.encoder" to use the "serializer" service');
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('serializer')
|
||||
->addArgument([])
|
||||
|
||||
@@ -52,12 +52,10 @@ class WorkflowGuardListenerPassTest extends TestCase
|
||||
$this->assertFalse($this->container->hasParameter('workflow.has_guard_listeners'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
|
||||
* @expectedExceptionMessage The "security.token_storage" service is needed to be able to use the workflow guard listener.
|
||||
*/
|
||||
public function testExceptionIfTheTokenStorageServiceIsNotPresent()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
|
||||
$this->expectExceptionMessage('The "security.token_storage" service is needed to be able to use the workflow guard listener.');
|
||||
$this->container->setParameter('workflow.has_guard_listeners', true);
|
||||
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
|
||||
$this->container->register('security.authentication.trust_resolver', AuthenticationTrustResolverInterface::class);
|
||||
@@ -66,12 +64,10 @@ class WorkflowGuardListenerPassTest extends TestCase
|
||||
$this->compilerPass->process($this->container);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
|
||||
* @expectedExceptionMessage The "security.authorization_checker" service is needed to be able to use the workflow guard listener.
|
||||
*/
|
||||
public function testExceptionIfTheAuthorizationCheckerServiceIsNotPresent()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
|
||||
$this->expectExceptionMessage('The "security.authorization_checker" service is needed to be able to use the workflow guard listener.');
|
||||
$this->container->setParameter('workflow.has_guard_listeners', true);
|
||||
$this->container->register('security.token_storage', TokenStorageInterface::class);
|
||||
$this->container->register('security.authentication.trust_resolver', AuthenticationTrustResolverInterface::class);
|
||||
@@ -80,12 +76,10 @@ class WorkflowGuardListenerPassTest extends TestCase
|
||||
$this->compilerPass->process($this->container);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
|
||||
* @expectedExceptionMessage The "security.authentication.trust_resolver" service is needed to be able to use the workflow guard listener.
|
||||
*/
|
||||
public function testExceptionIfTheAuthenticationTrustResolverServiceIsNotPresent()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
|
||||
$this->expectExceptionMessage('The "security.authentication.trust_resolver" service is needed to be able to use the workflow guard listener.');
|
||||
$this->container->setParameter('workflow.has_guard_listeners', true);
|
||||
$this->container->register('security.token_storage', TokenStorageInterface::class);
|
||||
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
|
||||
@@ -94,12 +88,10 @@ class WorkflowGuardListenerPassTest extends TestCase
|
||||
$this->compilerPass->process($this->container);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
|
||||
* @expectedExceptionMessage The "security.role_hierarchy" service is needed to be able to use the workflow guard listener.
|
||||
*/
|
||||
public function testExceptionIfTheRoleHierarchyServiceIsNotPresent()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
|
||||
$this->expectExceptionMessage('The "security.role_hierarchy" service is needed to be able to use the workflow guard listener.');
|
||||
$this->container->setParameter('workflow.has_guard_listeners', true);
|
||||
$this->container->register('security.token_storage', TokenStorageInterface::class);
|
||||
$this->container->register('security.authorization_checker', AuthorizationCheckerInterface::class);
|
||||
|
||||
@@ -104,10 +104,10 @@ class ConfigurationTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider getTestInvalidSessionName
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
*/
|
||||
public function testInvalidSessionName($sessionName)
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$processor = new Processor();
|
||||
$processor->processConfiguration(
|
||||
new Configuration(true),
|
||||
@@ -160,10 +160,10 @@ class ConfigurationTest extends TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
*/
|
||||
public function testInvalidTypeTrustedProxies()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration(true);
|
||||
$processor->processConfiguration($configuration, [
|
||||
@@ -176,10 +176,10 @@ class ConfigurationTest extends TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
*/
|
||||
public function testInvalidValueTrustedProxies()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration(true);
|
||||
|
||||
@@ -245,12 +245,8 @@ class ConfigurationTest extends TestCase
|
||||
*/
|
||||
public function testInvalidAssetsConfiguration(array $assetConfig, $expectedMessage)
|
||||
{
|
||||
if (method_exists($this, 'expectException')) {
|
||||
$this->expectException(InvalidConfigurationException::class);
|
||||
$this->expectExceptionMessage($expectedMessage);
|
||||
} else {
|
||||
$this->setExpectedException(InvalidConfigurationException::class, $expectedMessage);
|
||||
}
|
||||
$this->expectException(InvalidConfigurationException::class);
|
||||
$this->expectExceptionMessage($expectedMessage);
|
||||
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration(true);
|
||||
@@ -296,6 +292,69 @@ class ConfigurationTest extends TestCase
|
||||
yield [$createPackageConfig($config), 'You cannot use both "version" and "json_manifest_path" at the same time under "assets" packages.'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidLockConfigurationTests
|
||||
*/
|
||||
public function testValidLockConfiguration($lockConfig, $processedConfig)
|
||||
{
|
||||
$processor = new Processor();
|
||||
$configuration = new Configuration(true);
|
||||
$config = $processor->processConfiguration($configuration, [
|
||||
[
|
||||
'lock' => $lockConfig,
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertArrayHasKey('lock', $config);
|
||||
|
||||
$this->assertEquals($processedConfig, $config['lock']);
|
||||
}
|
||||
|
||||
public function provideValidLockConfigurationTests()
|
||||
{
|
||||
yield [null, ['enabled' => true, 'resources' => ['default' => [class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported() ? 'semaphore' : 'flock']]]];
|
||||
|
||||
yield ['flock', ['enabled' => true, 'resources' => ['default' => ['flock']]]];
|
||||
yield [['flock', 'semaphore'], ['enabled' => true, 'resources' => ['default' => ['flock', 'semaphore']]]];
|
||||
yield [['foo' => 'flock', 'bar' => 'semaphore'], ['enabled' => true, 'resources' => ['foo' => ['flock'], 'bar' => ['semaphore']]]];
|
||||
yield [['foo' => ['flock', 'semaphore'], 'bar' => 'semaphore'], ['enabled' => true, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => ['semaphore']]]];
|
||||
yield [['default' => 'flock'], ['enabled' => true, 'resources' => ['default' => ['flock']]]];
|
||||
|
||||
yield [['enabled' => false, 'flock'], ['enabled' => false, 'resources' => ['default' => ['flock']]]];
|
||||
yield [['enabled' => false, ['flock', 'semaphore']], ['enabled' => false, 'resources' => ['default' => ['flock', 'semaphore']]]];
|
||||
yield [['enabled' => false, 'foo' => 'flock', 'bar' => 'semaphore'], ['enabled' => false, 'resources' => ['foo' => ['flock'], 'bar' => ['semaphore']]]];
|
||||
yield [['enabled' => false, 'foo' => ['flock', 'semaphore']], ['enabled' => false, 'resources' => ['foo' => ['flock', 'semaphore']]]];
|
||||
yield [['enabled' => false, 'default' => 'flock'], ['enabled' => false, 'resources' => ['default' => ['flock']]]];
|
||||
|
||||
yield [['resources' => 'flock'], ['enabled' => true, 'resources' => ['default' => ['flock']]]];
|
||||
yield [['resources' => ['flock', 'semaphore']], ['enabled' => true, 'resources' => ['default' => ['flock', 'semaphore']]]];
|
||||
yield [['resources' => ['foo' => 'flock', 'bar' => 'semaphore']], ['enabled' => true, 'resources' => ['foo' => ['flock'], 'bar' => ['semaphore']]]];
|
||||
yield [['resources' => ['foo' => ['flock', 'semaphore'], 'bar' => 'semaphore']], ['enabled' => true, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => ['semaphore']]]];
|
||||
yield [['resources' => ['default' => 'flock']], ['enabled' => true, 'resources' => ['default' => ['flock']]]];
|
||||
|
||||
yield [['enabled' => false, 'resources' => 'flock'], ['enabled' => false, 'resources' => ['default' => ['flock']]]];
|
||||
yield [['enabled' => false, 'resources' => ['flock', 'semaphore']], ['enabled' => false, 'resources' => ['default' => ['flock', 'semaphore']]]];
|
||||
yield [['enabled' => false, 'resources' => ['foo' => 'flock', 'bar' => 'semaphore']], ['enabled' => false, 'resources' => ['foo' => ['flock'], 'bar' => ['semaphore']]]];
|
||||
yield [['enabled' => false, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => 'semaphore']], ['enabled' => false, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => ['semaphore']]]];
|
||||
yield [['enabled' => false, 'resources' => ['default' => 'flock']], ['enabled' => false, 'resources' => ['default' => ['flock']]]];
|
||||
|
||||
// xml
|
||||
|
||||
yield [['resource' => ['flock']], ['enabled' => true, 'resources' => ['default' => ['flock']]]];
|
||||
yield [['resource' => ['flock', ['name' => 'foo', 'value' => 'semaphore']]], ['enabled' => true, 'resources' => ['default' => ['flock'], 'foo' => ['semaphore']]]];
|
||||
yield [['resource' => [['name' => 'foo', 'value' => 'flock']]], ['enabled' => true, 'resources' => ['foo' => ['flock']]]];
|
||||
yield [['resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'foo', 'value' => 'semaphore']]], ['enabled' => true, 'resources' => ['foo' => ['flock', 'semaphore']]]];
|
||||
yield [['resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'bar', 'value' => 'semaphore']]], ['enabled' => true, 'resources' => ['foo' => ['flock'], 'bar' => ['semaphore']]]];
|
||||
yield [['resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'foo', 'value' => 'semaphore'], ['name' => 'bar', 'value' => 'semaphore']]], ['enabled' => true, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => ['semaphore']]]];
|
||||
|
||||
yield [['enabled' => false, 'resource' => ['flock']], ['enabled' => false, 'resources' => ['default' => ['flock']]]];
|
||||
yield [['enabled' => false, 'resource' => ['flock', ['name' => 'foo', 'value' => 'semaphore']]], ['enabled' => false, 'resources' => ['default' => ['flock'], 'foo' => ['semaphore']]]];
|
||||
yield [['enabled' => false, 'resource' => [['name' => 'foo', 'value' => 'flock']]], ['enabled' => false, 'resources' => ['foo' => ['flock']]]];
|
||||
yield [['enabled' => false, 'resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'foo', 'value' => 'semaphore']]], ['enabled' => false, 'resources' => ['foo' => ['flock', 'semaphore']]]];
|
||||
yield [['enabled' => false, 'resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'bar', 'value' => 'semaphore']]], ['enabled' => false, 'resources' => ['foo' => ['flock'], 'bar' => ['semaphore']]]];
|
||||
yield [['enabled' => false, 'resource' => [['name' => 'foo', 'value' => 'flock'], ['name' => 'foo', 'value' => 'semaphore'], ['name' => 'bar', 'value' => 'semaphore']]], ['enabled' => false, 'resources' => ['foo' => ['flock', 'semaphore'], 'bar' => ['semaphore']]]];
|
||||
}
|
||||
|
||||
protected static function getBundleDefaultConfig()
|
||||
{
|
||||
return [
|
||||
@@ -378,6 +437,7 @@ class ConfigurationTest extends TestCase
|
||||
'handler_id' => 'session.handler.native_file',
|
||||
'cookie_httponly' => true,
|
||||
'gc_probability' => 1,
|
||||
'save_path' => '%kernel.cache_dir%/sessions',
|
||||
'metadata_update_threshold' => '0',
|
||||
'use_strict_mode' => true,
|
||||
],
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
<?php
|
||||
|
||||
$container->loadFromExtension('framework', [
|
||||
'session' => [
|
||||
'handler_id' => null,
|
||||
'save_path' => '/some/path',
|
||||
],
|
||||
]);
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" ?>
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:framework="http://symfony.com/schema/dic/symfony"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
|
||||
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
|
||||
|
||||
<framework:config>
|
||||
<framework:session handler-id="null" save-path="/some/path"/>
|
||||
</framework:config>
|
||||
</container>
|
||||
@@ -1,4 +0,0 @@
|
||||
framework:
|
||||
session:
|
||||
handler_id: null
|
||||
save_path: /some/path
|
||||
@@ -85,7 +85,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$container = $this->createContainerFromFile('property_accessor');
|
||||
|
||||
if (!method_exists(PropertyAccessor::class, 'createCache')) {
|
||||
return $this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
$this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$cache = $container->getDefinition('cache.property_access');
|
||||
@@ -98,7 +100,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$container = $this->createContainerFromFile('property_accessor', ['kernel.debug' => true]);
|
||||
|
||||
if (!method_exists(PropertyAccessor::class, 'createCache')) {
|
||||
return $this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
$this->assertFalse($container->hasDefinition('cache.property_access'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$cache = $container->getDefinition('cache.property_access');
|
||||
@@ -106,12 +110,10 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertSame(ArrayAdapter::class, $cache->getClass(), 'ArrayAdapter should be used in debug mode');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
* @expectedExceptionMessage CSRF protection needs sessions to be enabled.
|
||||
*/
|
||||
public function testCsrfProtectionNeedsSessionToBeEnabled()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->expectExceptionMessage('CSRF protection needs sessions to be enabled.');
|
||||
$this->createContainerFromFile('csrf_needs_session');
|
||||
}
|
||||
|
||||
@@ -249,42 +251,34 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
*/
|
||||
public function testDeprecatedWorkflowMissingType()
|
||||
{
|
||||
$container = $this->createContainerFromFile('workflows_without_type');
|
||||
$this->createContainerFromFile('workflows_without_type');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
* @expectedExceptionMessage "type" and "service" cannot be used together.
|
||||
*/
|
||||
public function testWorkflowCannotHaveBothTypeAndService()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$this->expectExceptionMessage('"type" and "service" cannot be used together.');
|
||||
$this->createContainerFromFile('workflow_with_type_and_service');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
* @expectedExceptionMessage "supports" and "support_strategy" cannot be used together.
|
||||
*/
|
||||
public function testWorkflowCannotHaveBothSupportsAndSupportStrategy()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$this->expectExceptionMessage('"supports" and "support_strategy" cannot be used together.');
|
||||
$this->createContainerFromFile('workflow_with_support_and_support_strategy');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
* @expectedExceptionMessage "supports" or "support_strategy" should be configured.
|
||||
*/
|
||||
public function testWorkflowShouldHaveOneOfSupportsAndSupportStrategy()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$this->expectExceptionMessage('"supports" or "support_strategy" should be configured.');
|
||||
$this->createContainerFromFile('workflow_without_support_and_support_strategy');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
* @expectedExceptionMessage "arguments" and "service" cannot be used together.
|
||||
*/
|
||||
public function testWorkflowCannotHaveBothArgumentsAndService()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$this->expectExceptionMessage('"arguments" and "service" cannot be used together.');
|
||||
$this->createContainerFromFile('workflow_with_arguments_and_service');
|
||||
}
|
||||
|
||||
@@ -430,11 +424,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertEquals('xml', $arguments[2]['resource_type'], '->registerRouterConfiguration() sets routing resource type');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
*/
|
||||
public function testRouterRequiresResourceOption()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$container = $this->createContainer();
|
||||
$loader = new FrameworkExtension();
|
||||
$loader->load([['router' => true]], $container);
|
||||
@@ -473,14 +465,6 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertNull($container->getDefinition('session.storage.php_bridge')->getArgument(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
*/
|
||||
public function testNullSessionHandlerWithSavePath()
|
||||
{
|
||||
$this->createContainerFromFile('session_savepath');
|
||||
}
|
||||
|
||||
public function testRequest()
|
||||
{
|
||||
$container = $this->createContainerFromFile('full');
|
||||
@@ -645,11 +629,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
$this->assertFalse($container->has('templating.helper.translator'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
|
||||
*/
|
||||
public function testTemplatingRequiresAtLeastOneEngine()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException');
|
||||
$container = $this->createContainer();
|
||||
$loader = new FrameworkExtension();
|
||||
$loader->load([['templating' => null]], $container);
|
||||
@@ -840,9 +822,9 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||
|
||||
$this->assertSame('addYamlMappings', $calls[4][0]);
|
||||
$this->assertCount(3, $calls[4][1][0]);
|
||||
$this->assertContains('foo.yml', $calls[4][1][0][0]);
|
||||
$this->assertContains('validation.yml', $calls[4][1][0][1]);
|
||||
$this->assertContains('validation.yaml', $calls[4][1][0][2]);
|
||||
$this->assertStringContainsString('foo.yml', $calls[4][1][0][0]);
|
||||
$this->assertStringContainsString('validation.yml', $calls[4][1][0][1]);
|
||||
$this->assertStringContainsString('validation.yaml', $calls[4][1][0][2]);
|
||||
}
|
||||
|
||||
public function testFormsCanBeEnabledWithoutCsrfProtection()
|
||||
|
||||
@@ -23,11 +23,9 @@ class PhpFrameworkExtensionTest extends FrameworkExtensionTest
|
||||
$loader->load($file.'.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
*/
|
||||
public function testAssetsCannotHavePathAndUrl()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->createContainerFromClosure(function ($container) {
|
||||
$container->loadFromExtension('framework', [
|
||||
'assets' => [
|
||||
@@ -38,11 +36,9 @@ class PhpFrameworkExtensionTest extends FrameworkExtensionTest
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \LogicException
|
||||
*/
|
||||
public function testAssetPackageCannotHavePathAndUrl()
|
||||
{
|
||||
$this->expectException('LogicException');
|
||||
$this->createContainerFromClosure(function ($container) {
|
||||
$container->loadFromExtension('framework', [
|
||||
'assets' => [
|
||||
|
||||
@@ -26,7 +26,7 @@ class TestExtension extends Extension implements PrependExtensionInterface
|
||||
public function load(array $configs, ContainerBuilder $container)
|
||||
{
|
||||
$configuration = $this->getConfiguration($configs, $container);
|
||||
$config = $this->processConfiguration($configuration, $configs);
|
||||
$this->processConfiguration($configuration, $configs);
|
||||
|
||||
$container->setAlias('test.annotation_reader', new Alias('annotation_reader', true));
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ class CachePoolClearCommandTest extends AbstractWebTestCase
|
||||
$tester->execute(['pools' => ['cache.private_pool']], ['decorated' => false]);
|
||||
|
||||
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
|
||||
$this->assertContains('Clearing cache pool: cache.private_pool', $tester->getDisplay());
|
||||
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Clearing cache pool: cache.private_pool', $tester->getDisplay());
|
||||
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testClearPublicPool()
|
||||
@@ -41,8 +41,8 @@ class CachePoolClearCommandTest extends AbstractWebTestCase
|
||||
$tester->execute(['pools' => ['cache.public_pool']], ['decorated' => false]);
|
||||
|
||||
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
|
||||
$this->assertContains('Clearing cache pool: cache.public_pool', $tester->getDisplay());
|
||||
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Clearing cache pool: cache.public_pool', $tester->getDisplay());
|
||||
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testClearPoolWithCustomClearer()
|
||||
@@ -51,8 +51,8 @@ class CachePoolClearCommandTest extends AbstractWebTestCase
|
||||
$tester->execute(['pools' => ['cache.pool_with_clearer']], ['decorated' => false]);
|
||||
|
||||
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
|
||||
$this->assertContains('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay());
|
||||
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Clearing cache pool: cache.pool_with_clearer', $tester->getDisplay());
|
||||
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testCallClearer()
|
||||
@@ -61,16 +61,14 @@ class CachePoolClearCommandTest extends AbstractWebTestCase
|
||||
$tester->execute(['pools' => ['cache.app_clearer']], ['decorated' => false]);
|
||||
|
||||
$this->assertSame(0, $tester->getStatusCode(), 'cache:pool:clear exits with 0 in case of success');
|
||||
$this->assertContains('Calling cache clearer: cache.app_clearer', $tester->getDisplay());
|
||||
$this->assertContains('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Calling cache clearer: cache.app_clearer', $tester->getDisplay());
|
||||
$this->assertStringContainsString('[OK] Cache was successfully cleared.', $tester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
|
||||
* @expectedExceptionMessage You have requested a non-existent service "unknown_pool"
|
||||
*/
|
||||
public function testClearUnexistingPool()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException');
|
||||
$this->expectExceptionMessage('You have requested a non-existent service "unknown_pool"');
|
||||
$this->createCommandTester()
|
||||
->execute(['pools' => ['unknown_pool']], ['decorated' => false]);
|
||||
}
|
||||
@@ -88,7 +86,7 @@ class CachePoolClearCommandTest extends AbstractWebTestCase
|
||||
|
||||
$tester->execute(['pools' => []]);
|
||||
|
||||
$this->assertContains('Cache was successfully cleared', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Cache was successfully cleared', $tester->getDisplay());
|
||||
}
|
||||
|
||||
private function createCommandTester()
|
||||
|
||||
@@ -34,7 +34,7 @@ class CachePoolsTest extends AbstractWebTestCase
|
||||
throw $e;
|
||||
}
|
||||
$this->markTestSkipped($e->getMessage());
|
||||
} catch (\PHPUnit_Framework_Error_Warning $e) {
|
||||
} catch (\PHPUnit\Framework\Error\Warning $e) {
|
||||
if (0 !== strpos($e->getMessage(), 'unable to connect to')) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ class CachePoolsTest extends AbstractWebTestCase
|
||||
throw $e;
|
||||
}
|
||||
$this->markTestSkipped($e->getMessage());
|
||||
} catch (\PHPUnit_Framework_Error_Warning $e) {
|
||||
} catch (\PHPUnit\Framework\Error\Warning $e) {
|
||||
if (0 !== strpos($e->getMessage(), 'unable to connect to')) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class ConfigDebugCommandTest extends AbstractWebTestCase
|
||||
$ret = $tester->execute(['name' => 'TestBundle']);
|
||||
|
||||
$this->assertSame(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertContains('custom: foo', $tester->getDisplay());
|
||||
$this->assertStringContainsString('custom: foo', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDumpBundleOption()
|
||||
@@ -45,7 +45,7 @@ class ConfigDebugCommandTest extends AbstractWebTestCase
|
||||
$ret = $tester->execute(['name' => 'TestBundle', 'path' => 'custom']);
|
||||
|
||||
$this->assertSame(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertContains('foo', $tester->getDisplay());
|
||||
$this->assertStringContainsString('foo', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testParametersValuesAreResolved()
|
||||
@@ -54,8 +54,8 @@ class ConfigDebugCommandTest extends AbstractWebTestCase
|
||||
$ret = $tester->execute(['name' => 'framework']);
|
||||
|
||||
$this->assertSame(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay());
|
||||
$this->assertContains('secret: test', $tester->getDisplay());
|
||||
$this->assertStringContainsString("locale: '%env(LOCALE)%'", $tester->getDisplay());
|
||||
$this->assertStringContainsString('secret: test', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDumpUndefinedBundleOption()
|
||||
@@ -63,7 +63,7 @@ class ConfigDebugCommandTest extends AbstractWebTestCase
|
||||
$tester = $this->createCommandTester();
|
||||
$tester->execute(['name' => 'TestBundle', 'path' => 'foo']);
|
||||
|
||||
$this->assertContains('Unable to find configuration for "test.foo"', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Unable to find configuration for "test.foo"', $tester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,8 +36,8 @@ class ConfigDumpReferenceCommandTest extends AbstractWebTestCase
|
||||
$ret = $tester->execute(['name' => 'TestBundle']);
|
||||
|
||||
$this->assertSame(0, $ret, 'Returns 0 in case of success');
|
||||
$this->assertContains('test:', $tester->getDisplay());
|
||||
$this->assertContains(' custom:', $tester->getDisplay());
|
||||
$this->assertStringContainsString('test:', $tester->getDisplay());
|
||||
$this->assertStringContainsString(' custom:', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testDumpAtPath()
|
||||
@@ -70,7 +70,7 @@ EOL
|
||||
]);
|
||||
|
||||
$this->assertSame(1, $ret);
|
||||
$this->assertContains('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay());
|
||||
$this->assertStringContainsString('[ERROR] The "path" option is only available for the "yaml" format.', $tester->getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ class ContainerDebugCommandTest extends AbstractWebTestCase
|
||||
$tester = new ApplicationTester($application);
|
||||
$tester->run(['command' => 'debug:container']);
|
||||
|
||||
$this->assertContains('public', $tester->getDisplay());
|
||||
$this->assertStringContainsString('public', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testPrivateAlias()
|
||||
@@ -56,11 +56,11 @@ class ContainerDebugCommandTest extends AbstractWebTestCase
|
||||
|
||||
$tester = new ApplicationTester($application);
|
||||
$tester->run(['command' => 'debug:container', '--show-private' => true]);
|
||||
$this->assertContains('public', $tester->getDisplay());
|
||||
$this->assertContains('private_alias', $tester->getDisplay());
|
||||
$this->assertStringContainsString('public', $tester->getDisplay());
|
||||
$this->assertStringContainsString('private_alias', $tester->getDisplay());
|
||||
|
||||
$tester->run(['command' => 'debug:container']);
|
||||
$this->assertContains('public', $tester->getDisplay());
|
||||
$this->assertNotContains('private_alias', $tester->getDisplay());
|
||||
$this->assertStringContainsString('public', $tester->getDisplay());
|
||||
$this->assertStringNotContainsString('private_alias', $tester->getDisplay());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase
|
||||
$tester = new ApplicationTester($application);
|
||||
$tester->run(['command' => 'debug:autowiring']);
|
||||
|
||||
$this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
|
||||
$this->assertContains('alias to http_kernel', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
|
||||
$this->assertStringContainsString('alias to http_kernel', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testSearchArgument()
|
||||
@@ -43,8 +43,8 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase
|
||||
$tester = new ApplicationTester($application);
|
||||
$tester->run(['command' => 'debug:autowiring', 'search' => 'kern']);
|
||||
|
||||
$this->assertContains('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
|
||||
$this->assertNotContains('Symfony\Component\Routing\RouterInterface', $tester->getDisplay());
|
||||
$this->assertStringContainsString('Symfony\Component\HttpKernel\HttpKernelInterface', $tester->getDisplay());
|
||||
$this->assertStringNotContainsString('Symfony\Component\Routing\RouterInterface', $tester->getDisplay());
|
||||
}
|
||||
|
||||
public function testSearchNoResults()
|
||||
@@ -57,7 +57,7 @@ class DebugAutowiringCommandTest extends AbstractWebTestCase
|
||||
$tester = new ApplicationTester($application);
|
||||
$tester->run(['command' => 'debug:autowiring', 'search' => 'foo_fake'], ['capture_stderr_separately' => true]);
|
||||
|
||||
$this->assertContains('No autowirable classes or interfaces found matching "foo_fake"', $tester->getErrorOutput());
|
||||
$this->assertStringContainsString('No autowirable classes or interfaces found matching "foo_fake"', $tester->getErrorOutput());
|
||||
$this->assertEquals(1, $tester->getStatusCode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,16 +24,16 @@ class ProfilerTest extends AbstractWebTestCase
|
||||
}
|
||||
|
||||
$client->request('GET', '/profiler');
|
||||
$this->assertFalse($client->getProfile());
|
||||
$this->assertNull($client->getProfile());
|
||||
|
||||
// enable the profiler for the next request
|
||||
$client->enableProfiler();
|
||||
$this->assertFalse($client->getProfile());
|
||||
$this->assertNull($client->getProfile());
|
||||
$client->request('GET', '/profiler');
|
||||
$this->assertInternalType('object', $client->getProfile());
|
||||
$this->assertIsObject($client->getProfile());
|
||||
|
||||
$client->request('GET', '/profiler');
|
||||
$this->assertFalse($client->getProfile());
|
||||
$this->assertNull($client->getProfile());
|
||||
}
|
||||
|
||||
public function getConfigs()
|
||||
|
||||
@@ -27,23 +27,23 @@ class SessionTest extends AbstractWebTestCase
|
||||
|
||||
// no session
|
||||
$crawler = $client->request('GET', '/session');
|
||||
$this->assertContains('You are new here and gave no name.', $crawler->text());
|
||||
$this->assertStringContainsString('You are new here and gave no name.', $crawler->text());
|
||||
|
||||
// remember name
|
||||
$crawler = $client->request('GET', '/session/drak');
|
||||
$this->assertContains('Hello drak, nice to meet you.', $crawler->text());
|
||||
$this->assertStringContainsString('Hello drak, nice to meet you.', $crawler->text());
|
||||
|
||||
// prove remembered name
|
||||
$crawler = $client->request('GET', '/session');
|
||||
$this->assertContains('Welcome back drak, nice to meet you.', $crawler->text());
|
||||
$this->assertStringContainsString('Welcome back drak, nice to meet you.', $crawler->text());
|
||||
|
||||
// clear session
|
||||
$crawler = $client->request('GET', '/session_logout');
|
||||
$this->assertContains('Session cleared.', $crawler->text());
|
||||
$this->assertStringContainsString('Session cleared.', $crawler->text());
|
||||
|
||||
// prove cleared session
|
||||
$crawler = $client->request('GET', '/session');
|
||||
$this->assertContains('You are new here and gave no name.', $crawler->text());
|
||||
$this->assertStringContainsString('You are new here and gave no name.', $crawler->text());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,14 +59,14 @@ class SessionTest extends AbstractWebTestCase
|
||||
}
|
||||
|
||||
// set flash
|
||||
$crawler = $client->request('GET', '/session_setflash/Hello%20world.');
|
||||
$client->request('GET', '/session_setflash/Hello%20world.');
|
||||
|
||||
// check flash displays on redirect
|
||||
$this->assertContains('Hello world.', $client->followRedirect()->text());
|
||||
$this->assertStringContainsString('Hello world.', $client->followRedirect()->text());
|
||||
|
||||
// check flash is gone
|
||||
$crawler = $client->request('GET', '/session_showflash');
|
||||
$this->assertContains('No flash was set.', $crawler->text());
|
||||
$this->assertStringContainsString('No flash was set.', $crawler->text());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,39 +91,39 @@ class SessionTest extends AbstractWebTestCase
|
||||
|
||||
// new session, so no name set.
|
||||
$crawler1 = $client1->request('GET', '/session');
|
||||
$this->assertContains('You are new here and gave no name.', $crawler1->text());
|
||||
$this->assertStringContainsString('You are new here and gave no name.', $crawler1->text());
|
||||
|
||||
// set name of client1
|
||||
$crawler1 = $client1->request('GET', '/session/client1');
|
||||
$this->assertContains('Hello client1, nice to meet you.', $crawler1->text());
|
||||
$this->assertStringContainsString('Hello client1, nice to meet you.', $crawler1->text());
|
||||
|
||||
// no session for client2
|
||||
$crawler2 = $client2->request('GET', '/session');
|
||||
$this->assertContains('You are new here and gave no name.', $crawler2->text());
|
||||
$this->assertStringContainsString('You are new here and gave no name.', $crawler2->text());
|
||||
|
||||
// remember name client2
|
||||
$crawler2 = $client2->request('GET', '/session/client2');
|
||||
$this->assertContains('Hello client2, nice to meet you.', $crawler2->text());
|
||||
$this->assertStringContainsString('Hello client2, nice to meet you.', $crawler2->text());
|
||||
|
||||
// prove remembered name of client1
|
||||
$crawler1 = $client1->request('GET', '/session');
|
||||
$this->assertContains('Welcome back client1, nice to meet you.', $crawler1->text());
|
||||
$this->assertStringContainsString('Welcome back client1, nice to meet you.', $crawler1->text());
|
||||
|
||||
// prove remembered name of client2
|
||||
$crawler2 = $client2->request('GET', '/session');
|
||||
$this->assertContains('Welcome back client2, nice to meet you.', $crawler2->text());
|
||||
$this->assertStringContainsString('Welcome back client2, nice to meet you.', $crawler2->text());
|
||||
|
||||
// clear client1
|
||||
$crawler1 = $client1->request('GET', '/session_logout');
|
||||
$this->assertContains('Session cleared.', $crawler1->text());
|
||||
$this->assertStringContainsString('Session cleared.', $crawler1->text());
|
||||
|
||||
// prove client1 data is cleared
|
||||
$crawler1 = $client1->request('GET', '/session');
|
||||
$this->assertContains('You are new here and gave no name.', $crawler1->text());
|
||||
$this->assertStringContainsString('You are new here and gave no name.', $crawler1->text());
|
||||
|
||||
// prove remembered name of client2 remains untouched.
|
||||
$crawler2 = $client2->request('GET', '/session');
|
||||
$this->assertContains('Welcome back client2, nice to meet you.', $crawler2->text());
|
||||
$this->assertStringContainsString('Welcome back client2, nice to meet you.', $crawler2->text());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Routing;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Bundle\FrameworkBundle\Routing\Router;
|
||||
use Symfony\Component\DependencyInjection\Config\ContainerParametersResource;
|
||||
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
|
||||
use Symfony\Component\Routing\Route;
|
||||
use Symfony\Component\Routing\RouteCollection;
|
||||
|
||||
@@ -122,23 +123,21 @@ class RouterTest extends TestCase
|
||||
$routes->add('foo', new Route('/before/%parameter.foo%/after/%%escaped%%'));
|
||||
|
||||
$sc = $this->getServiceContainer($routes);
|
||||
$sc->setParameter('parameter.foo', 'foo');
|
||||
$sc->setParameter('parameter.foo', 'foo-%%escaped%%');
|
||||
|
||||
$router = new Router($sc, 'foo');
|
||||
$route = $router->getRouteCollection()->get('foo');
|
||||
|
||||
$this->assertEquals(
|
||||
'/before/foo/after/%escaped%',
|
||||
'/before/foo-%escaped%/after/%escaped%',
|
||||
$route->getPath()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage Using "%env(FOO)%" is not allowed in routing configuration.
|
||||
*/
|
||||
public function testEnvPlaceholders()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||
$this->expectExceptionMessage('Using "%env(FOO)%" is not allowed in routing configuration.');
|
||||
$routes = new RouteCollection();
|
||||
|
||||
$routes->add('foo', new Route('/%env(FOO)%'));
|
||||
@@ -147,6 +146,22 @@ class RouterTest extends TestCase
|
||||
$router->getRouteCollection();
|
||||
}
|
||||
|
||||
public function testIndirectEnvPlaceholders()
|
||||
{
|
||||
$routes = new RouteCollection();
|
||||
|
||||
$routes->add('foo', new Route('/%foo%'));
|
||||
|
||||
$router = new Router($container = $this->getServiceContainer($routes), 'foo');
|
||||
$container->setParameter('foo', 'foo-%bar%');
|
||||
$container->setParameter('bar', '%env(string:FOO)%');
|
||||
|
||||
$this->expectException(RuntimeException::class);
|
||||
$this->expectExceptionMessage('Using "%env(string:FOO)%" is not allowed in routing configuration.');
|
||||
|
||||
$router->getRouteCollection();
|
||||
}
|
||||
|
||||
public function testHostPlaceholders()
|
||||
{
|
||||
$routes = new RouteCollection();
|
||||
@@ -168,12 +183,10 @@ class RouterTest extends TestCase
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
|
||||
* @expectedExceptionMessage You have requested a non-existent parameter "nope".
|
||||
*/
|
||||
public function testExceptionOnNonExistentParameter()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException');
|
||||
$this->expectExceptionMessage('You have requested a non-existent parameter "nope".');
|
||||
$routes = new RouteCollection();
|
||||
|
||||
$routes->add('foo', new Route('/%nope%'));
|
||||
@@ -184,12 +197,10 @@ class RouterTest extends TestCase
|
||||
$router->getRouteCollection()->get('foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException
|
||||
* @expectedExceptionMessage The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type object.
|
||||
*/
|
||||
public function testExceptionOnNonStringParameter()
|
||||
{
|
||||
$this->expectException('Symfony\Component\DependencyInjection\Exception\RuntimeException');
|
||||
$this->expectExceptionMessage('The container parameter "object", used in the route configuration value "/%object%", must be a string or numeric, but it is of type object.');
|
||||
$routes = new RouteCollection();
|
||||
|
||||
$routes->add('foo', new Route('/%object%'));
|
||||
|
||||
@@ -43,12 +43,10 @@ class DelegatingEngineTest extends TestCase
|
||||
$this->assertSame($secondEngine, $delegatingEngine->getEngine('template.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage No engine is able to work with the template "template.php"
|
||||
*/
|
||||
public function testGetInvalidEngine()
|
||||
{
|
||||
$this->expectException('RuntimeException');
|
||||
$this->expectExceptionMessage('No engine is able to work with the template "template.php"');
|
||||
$firstEngine = $this->getEngineMock('template.php', false);
|
||||
$secondEngine = $this->getEngineMock('template.php', false);
|
||||
$container = $this->getContainerMock([
|
||||
|
||||
@@ -52,11 +52,12 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
/**
|
||||
* @after
|
||||
*/
|
||||
public function doTearDown()
|
||||
{
|
||||
$this->engine = null;
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
public function testStartTagHasNoActionAttributeWhenActionIsEmpty()
|
||||
|
||||
@@ -77,11 +77,12 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest
|
||||
]);
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
/**
|
||||
* @after
|
||||
*/
|
||||
public function doTearDown()
|
||||
{
|
||||
$this->engine = null;
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
protected function renderForm(FormView $view, array $vars = [])
|
||||
|
||||
@@ -69,7 +69,7 @@ class TemplateLocatorTest extends TestCase
|
||||
$locator->locate($template);
|
||||
$this->fail('->locate() should throw an exception when the file is not found.');
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$this->assertContains(
|
||||
$this->assertStringContainsString(
|
||||
$errorMessage,
|
||||
$e->getMessage(),
|
||||
'TemplateLocator exception should propagate the FileLocator exception message'
|
||||
@@ -77,11 +77,9 @@ class TemplateLocatorTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testThrowsAnExceptionWhenTemplateIsNotATemplateReferenceInterface()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$locator = new TemplateLocator($this->getFileLocator());
|
||||
$locator->locate('template');
|
||||
}
|
||||
|
||||
@@ -43,11 +43,9 @@ class PhpEngineTest extends TestCase
|
||||
$this->assertEmpty($globals['app']->getRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testGetInvalidHelper()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$container = $this->getContainer();
|
||||
$loader = $this->getMockForAbstractClass('Symfony\Component\Templating\Loader\Loader');
|
||||
$engine = new PhpEngine(new TemplateNameParser(), $container, $loader);
|
||||
|
||||
@@ -74,11 +74,9 @@ class TemplateNameParserTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testParseValidNameWithNotFoundBundle()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->parser->parse('BarBundle:Post:index.html.php');
|
||||
}
|
||||
|
||||
|
||||
@@ -107,10 +107,10 @@ class TranslatorTest extends TestCase
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation The "Symfony\Bundle\FrameworkBundle\Translation\Translator::__construct()" method takes the default locale as the 3rd argument since Symfony 3.3. Not passing it is deprecated and will trigger an error in 4.0.
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testTransWithCachingWithInvalidLocaleOmittingLocale()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
|
||||
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir], 'loader', '\Symfony\Bundle\FrameworkBundle\Tests\Translation\TranslatorWithInvalidLocale', null);
|
||||
|
||||
@@ -156,13 +156,13 @@ class TranslatorTest extends TestCase
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Missing third $defaultLocale argument.
|
||||
*/
|
||||
public function testGetDefaultLocaleOmittingLocaleWithPsrContainer()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Missing third $defaultLocale argument.');
|
||||
$container = $this->getMockBuilder(ContainerInterface::class)->getMock();
|
||||
$translator = new Translator($container, new MessageFormatter());
|
||||
new Translator($container, new MessageFormatter());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -247,12 +247,10 @@ class TranslatorTest extends TestCase
|
||||
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Invalid "invalid locale" locale.
|
||||
*/
|
||||
public function testTransWithCachingWithInvalidLocale()
|
||||
{
|
||||
$this->expectException('InvalidArgumentException');
|
||||
$this->expectExceptionMessage('Invalid "invalid locale" locale.');
|
||||
$loader = $this->getMockBuilder('Symfony\Component\Translation\Loader\LoaderInterface')->getMock();
|
||||
$translator = $this->getTranslator($loader, ['cache_dir' => $this->tmpDir], 'loader', '\Symfony\Bundle\FrameworkBundle\Tests\Translation\TranslatorWithInvalidLocale');
|
||||
|
||||
@@ -282,12 +280,10 @@ class TranslatorTest extends TestCase
|
||||
$this->assertSame('en', $translator->getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Translation\Exception\InvalidArgumentException
|
||||
* @expectedExceptionMessage The Translator does not support the following options: 'foo'
|
||||
*/
|
||||
public function testInvalidOptions()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Translation\Exception\InvalidArgumentException');
|
||||
$this->expectExceptionMessage('The Translator does not support the following options: \'foo\'');
|
||||
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerInterface')->getMock();
|
||||
|
||||
(new Translator($container, new MessageFormatter(), 'en', [], ['foo' => 'bar']));
|
||||
|
||||
@@ -59,11 +59,9 @@ class ConstraintValidatorFactoryTest extends TestCase
|
||||
$this->assertSame($validator, $factory->getInstance(new ConstraintAliasStub()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Validator\Exception\ValidatorException
|
||||
*/
|
||||
public function testGetInstanceInvalidValidatorClass()
|
||||
{
|
||||
$this->expectException('Symfony\Component\Validator\Exception\ValidatorException');
|
||||
$constraint = $this->getMockBuilder('Symfony\\Component\\Validator\\Constraint')->getMock();
|
||||
$constraint
|
||||
->expects($this->exactly(2))
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
"require": {
|
||||
"php": "^5.5.9|>=7.0.8",
|
||||
"ext-xml": "*",
|
||||
"symfony/cache": "~3.4|~4.0",
|
||||
"symfony/cache": "~3.4.31|^4.3.4",
|
||||
"symfony/class-loader": "~3.2",
|
||||
"symfony/dependency-injection": "^3.4.24|^4.2.5",
|
||||
"symfony/config": "~3.4|~4.0",
|
||||
"symfony/config": "^3.4.31|^4.3.4",
|
||||
"symfony/debug": "~2.8|~3.0|~4.0",
|
||||
"symfony/event-dispatcher": "~3.4|~4.0",
|
||||
"symfony/http-foundation": "^3.3.11|~4.0",
|
||||
"symfony/http-kernel": "~3.4|~4.0",
|
||||
"symfony/http-foundation": "^3.4.13|~4.3",
|
||||
"symfony/http-kernel": "^3.4.31|^4.3.4",
|
||||
"symfony/polyfill-mbstring": "~1.0",
|
||||
"symfony/filesystem": "~2.8|~3.0|~4.0",
|
||||
"symfony/finder": "~2.8|~3.0|~4.0",
|
||||
@@ -36,11 +36,11 @@
|
||||
"fig/link-util": "^1.0",
|
||||
"symfony/asset": "~3.3|~4.0",
|
||||
"symfony/browser-kit": "~2.8|~3.0|~4.0",
|
||||
"symfony/console": "~3.4|~4.0",
|
||||
"symfony/console": "~3.4.31|^4.3.4",
|
||||
"symfony/css-selector": "~2.8|~3.0|~4.0",
|
||||
"symfony/dom-crawler": "~2.8|~3.0|~4.0",
|
||||
"symfony/polyfill-intl-icu": "~1.0",
|
||||
"symfony/form": "^3.4.22|~4.1.11|^4.2.3",
|
||||
"symfony/form": "^3.4.31|^4.3.4",
|
||||
"symfony/expression-language": "~2.8|~3.0|~4.0",
|
||||
"symfony/process": "~2.8|~3.0|~4.0",
|
||||
"symfony/security-core": "~3.2|~4.0",
|
||||
@@ -56,7 +56,7 @@
|
||||
"symfony/property-info": "~3.3|~4.0",
|
||||
"symfony/lock": "~3.4|~4.0",
|
||||
"symfony/web-link": "~3.3|~4.0",
|
||||
"doctrine/annotations": "~1.0",
|
||||
"doctrine/annotations": "~1.7",
|
||||
"phpdocumentor/reflection-docblock": "^3.0|^4.0",
|
||||
"twig/twig": "~1.34|~2.4"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user