Merge branch '4.2'
* 4.2: update years in license files Fix: Adjust DocBlock \"ParserTest->getParserTestData()\" -> only some more tests access the container getting it from the kernel Replace slave and master by replica and primary Fix erasing cookies issue [Lock] Pedantic improvements for lock [EventDispatcher] Fixed phpdoc on interface update year in license files [VarExporter] fix exporting array indexes [SecurityBundle] Fix traceable voters [Console] Fix help text for single command applications Fix random test failure on lock improve error message when using test client without the BrowserKit component Fixed minor typos in an error message [Event Dispatcher] fixed 29703: TraceableEventDispatcher reset now sets callStack to null with test to dispatch after reset. Fixed minor typos Fix: Method can also return null [Stopwatch] Fixed phpdoc for category name
This commit is contained in:
commit
3860d685f4
2
LICENSE
2
LICENSE
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -52,7 +52,7 @@ interface RegistryInterface extends ManagerRegistryInterface
|
|||||||
* it makes sense to get a new one to replace the closed one.
|
* it makes sense to get a new one to replace the closed one.
|
||||||
*
|
*
|
||||||
* Be warned that you will get a brand new entity manager as
|
* Be warned that you will get a brand new entity manager as
|
||||||
* the existing one is not useable anymore. This means that any
|
* the existing one is not usable anymore. This means that any
|
||||||
* other object with a dependency on this entity manager will
|
* other object with a dependency on this entity manager will
|
||||||
* hold an obsolete reference. You can inject the registry instead
|
* hold an obsolete reference. You can inject the registry instead
|
||||||
* to avoid this problem.
|
* to avoid this problem.
|
||||||
|
@ -64,7 +64,7 @@ class DoctrineExtensionTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$bundles = array(
|
$bundles = array(
|
||||||
'FristBundle' => 'My\FristBundle',
|
'FirstBundle' => 'My\FirstBundle',
|
||||||
'SecondBundle' => 'My\SecondBundle',
|
'SecondBundle' => 'My\SecondBundle',
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class DoctrineExtensionTest extends TestCase
|
|||||||
array(),
|
array(),
|
||||||
array(
|
array(
|
||||||
'mappings' => array(
|
'mappings' => array(
|
||||||
'FristBundle' => array(
|
'FirstBundle' => array(
|
||||||
'mapping' => true,
|
'mapping' => true,
|
||||||
'is_bundle' => true,
|
'is_bundle' => true,
|
||||||
),
|
),
|
||||||
@ -132,7 +132,7 @@ class DoctrineExtensionTest extends TestCase
|
|||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'mappings' => array(
|
'mappings' => array(
|
||||||
'FristBundle' => array(
|
'FirstBundle' => array(
|
||||||
'mapping' => true,
|
'mapping' => true,
|
||||||
'is_bundle' => true,
|
'is_bundle' => true,
|
||||||
),
|
),
|
||||||
@ -153,7 +153,7 @@ class DoctrineExtensionTest extends TestCase
|
|||||||
);
|
);
|
||||||
|
|
||||||
$bundles = array(
|
$bundles = array(
|
||||||
'FristBundle' => 'My\FristBundle',
|
'FirstBundle' => 'My\FirstBundle',
|
||||||
'SecondBundle' => 'My\SecondBundle',
|
'SecondBundle' => 'My\SecondBundle',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2014-2018 Fabien Potencier
|
Copyright (c) 2014-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2014-2018 Fabien Potencier
|
Copyright (c) 2014-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -96,7 +96,7 @@ EOT
|
|||||||
$targetArg = rtrim($input->getArgument('target'), '/');
|
$targetArg = rtrim($input->getArgument('target'), '/');
|
||||||
|
|
||||||
if (!$targetArg) {
|
if (!$targetArg) {
|
||||||
$targetArg = $this->getPublicDirectory($this->getContainer());
|
$targetArg = $this->getPublicDirectory($kernel->getContainer());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_dir($targetArg)) {
|
if (!is_dir($targetArg)) {
|
||||||
|
@ -21,6 +21,7 @@ use Symfony\Bridge\Twig\Extension\CsrfExtension;
|
|||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
|
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
|
||||||
use Symfony\Bundle\FullStack;
|
use Symfony\Bundle\FullStack;
|
||||||
|
use Symfony\Component\BrowserKit\Client;
|
||||||
use Symfony\Component\Cache\Adapter\AbstractAdapter;
|
use Symfony\Component\Cache\Adapter\AbstractAdapter;
|
||||||
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
use Symfony\Component\Cache\Adapter\AdapterInterface;
|
||||||
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
use Symfony\Component\Cache\Adapter\ArrayAdapter;
|
||||||
@ -198,6 +199,10 @@ class FrameworkExtension extends Extension
|
|||||||
|
|
||||||
if (!empty($config['test'])) {
|
if (!empty($config['test'])) {
|
||||||
$loader->load('test.xml');
|
$loader->load('test.xml');
|
||||||
|
|
||||||
|
if (!class_exists(Client::class)) {
|
||||||
|
$container->removeDefinition('test.client');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isConfigEnabled($container, $config['session'])) {
|
if ($this->isConfigEnabled($container, $config['session'])) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
namespace Symfony\Bundle\FrameworkBundle\Test;
|
namespace Symfony\Bundle\FrameworkBundle\Test;
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Client;
|
use Symfony\Bundle\FrameworkBundle\Client;
|
||||||
|
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebTestCase is the base class for functional tests.
|
* WebTestCase is the base class for functional tests.
|
||||||
@ -32,7 +33,12 @@ abstract class WebTestCase extends KernelTestCase
|
|||||||
{
|
{
|
||||||
$kernel = static::bootKernel($options);
|
$kernel = static::bootKernel($options);
|
||||||
|
|
||||||
|
try {
|
||||||
$client = $kernel->getContainer()->get('test.client');
|
$client = $kernel->getContainer()->get('test.client');
|
||||||
|
} catch (ServiceNotFoundException $e) {
|
||||||
|
throw new \LogicException('You cannot create the client used in functional tests if the BrowserKit component is not available. Try running "composer require symfony/browser-kit".');
|
||||||
|
}
|
||||||
|
|
||||||
$client->setServerParameters($server);
|
$client->setServerParameters($server);
|
||||||
|
|
||||||
return $client;
|
return $client;
|
||||||
|
@ -44,7 +44,7 @@ class AddSecurityVotersPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
$debug = $container->getParameter('kernel.debug');
|
$debug = $container->getParameter('kernel.debug');
|
||||||
|
$voterServices = array();
|
||||||
foreach ($voters as $voter) {
|
foreach ($voters as $voter) {
|
||||||
$voterServiceId = (string) $voter;
|
$voterServiceId = (string) $voter;
|
||||||
$definition = $container->getDefinition($voterServiceId);
|
$definition = $container->getDefinition($voterServiceId);
|
||||||
@ -56,17 +56,18 @@ class AddSecurityVotersPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
// Decorate original voters with TraceableVoter
|
$voterServices[] = new Reference($debugVoterServiceId = 'debug.security.voter.'.$voterServiceId);
|
||||||
$debugVoterServiceId = 'debug.security.voter.'.$voterServiceId;
|
|
||||||
$container
|
$container
|
||||||
->register($debugVoterServiceId, TraceableVoter::class)
|
->register($debugVoterServiceId, TraceableVoter::class)
|
||||||
->setDecoratedService($voterServiceId)
|
->addArgument($voter)
|
||||||
->addArgument(new Reference($debugVoterServiceId.'.inner'))
|
|
||||||
->addArgument(new Reference('event_dispatcher'));
|
->addArgument(new Reference('event_dispatcher'));
|
||||||
|
} else {
|
||||||
|
$voterServices[] = $voter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$adm = $container->getDefinition('security.access.decision_manager');
|
$container->getDefinition('security.access.decision_manager')
|
||||||
$adm->replaceArgument(0, new IteratorArgument($voters));
|
->replaceArgument(0, new IteratorArgument($voterServices));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -72,10 +72,7 @@ class AddSecurityVotersPassTest extends TestCase
|
|||||||
$this->assertCount(4, $refs);
|
$this->assertCount(4, $refs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testThatVotersAreTraceableInDebugMode(): void
|
||||||
* Test that in debug mode, voters are correctly decorated.
|
|
||||||
*/
|
|
||||||
public function testThatVotersAreDecoratedInDebugMode(): void
|
|
||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
|
|
||||||
@ -96,21 +93,18 @@ class AddSecurityVotersPassTest extends TestCase
|
|||||||
$compilerPass->process($container);
|
$compilerPass->process($container);
|
||||||
|
|
||||||
$def1 = $container->getDefinition('debug.security.voter.voter1');
|
$def1 = $container->getDefinition('debug.security.voter.voter1');
|
||||||
$this->assertEquals(array('voter1', null, 0), $def1->getDecoratedService(), 'voter1: wrong return from getDecoratedService');
|
$this->assertNull($def1->getDecoratedService(), 'voter1: should not be decorated');
|
||||||
$this->assertEquals(new Reference('debug.security.voter.voter1.inner'), $def1->getArgument(0), 'voter1: wrong decorator argument');
|
$this->assertEquals(new Reference('voter1'), $def1->getArgument(0), 'voter1: wrong argument');
|
||||||
|
|
||||||
$def2 = $container->getDefinition('debug.security.voter.voter2');
|
$def2 = $container->getDefinition('debug.security.voter.voter2');
|
||||||
$this->assertEquals(array('voter2', null, 0), $def2->getDecoratedService(), 'voter2: wrong return from getDecoratedService');
|
$this->assertNull($def2->getDecoratedService(), 'voter2: should not be decorated');
|
||||||
$this->assertEquals(new Reference('debug.security.voter.voter2.inner'), $def2->getArgument(0), 'voter2: wrong decorator argument');
|
$this->assertEquals(new Reference('voter2'), $def2->getArgument(0), 'voter2: wrong argument');
|
||||||
|
|
||||||
$voters = $container->findTaggedServiceIds('security.voter');
|
$voters = $container->findTaggedServiceIds('security.voter');
|
||||||
$this->assertCount(2, $voters, 'Incorrect count of voters');
|
$this->assertCount(2, $voters, 'Incorrect count of voters');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testThatVotersAreNotTraceableWithoutDebugMode(): void
|
||||||
* Test that voters are not decorated if the application is not in debug mode.
|
|
||||||
*/
|
|
||||||
public function testThatVotersAreNotDecoratedWithoutDebugMode(): void
|
|
||||||
{
|
{
|
||||||
$container = new ContainerBuilder();
|
$container = new ContainerBuilder();
|
||||||
$container->setParameter('kernel.debug', false);
|
$container->setParameter('kernel.debug', false);
|
||||||
@ -130,8 +124,8 @@ class AddSecurityVotersPassTest extends TestCase
|
|||||||
$compilerPass = new AddSecurityVotersPass();
|
$compilerPass = new AddSecurityVotersPass();
|
||||||
$compilerPass->process($container);
|
$compilerPass->process($container);
|
||||||
|
|
||||||
$this->assertFalse($container->has('debug.security.voter.voter1'), 'voter1 should not be decorated');
|
$this->assertFalse($container->has('debug.security.voter.voter1'), 'voter1 should not be traced');
|
||||||
$this->assertFalse($container->has('debug.security.voter.voter2'), 'voter2 should not be decorated');
|
$this->assertFalse($container->has('debug.security.voter.voter2'), 'voter2 should not be traced');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016-2018 Fabien Potencier
|
Copyright (c) 2016-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -75,7 +75,7 @@ class Application
|
|||||||
private $dispatcher;
|
private $dispatcher;
|
||||||
private $terminal;
|
private $terminal;
|
||||||
private $defaultCommand;
|
private $defaultCommand;
|
||||||
private $singleCommand;
|
private $singleCommand = false;
|
||||||
private $initialized;
|
private $initialized;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1098,6 +1098,14 @@ class Application
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
public function isSingleCommand()
|
||||||
|
{
|
||||||
|
return $this->singleCommand;
|
||||||
|
}
|
||||||
|
|
||||||
private function splitStringByWidth($string, $width)
|
private function splitStringByWidth($string, $width)
|
||||||
{
|
{
|
||||||
// str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly.
|
// str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly.
|
||||||
|
@ -525,6 +525,7 @@ class Command
|
|||||||
public function getProcessedHelp()
|
public function getProcessedHelp()
|
||||||
{
|
{
|
||||||
$name = $this->name;
|
$name = $this->name;
|
||||||
|
$isSingleCommand = $this->application && $this->application->isSingleCommand();
|
||||||
|
|
||||||
$placeholders = array(
|
$placeholders = array(
|
||||||
'%command.name%',
|
'%command.name%',
|
||||||
@ -532,7 +533,7 @@ class Command
|
|||||||
);
|
);
|
||||||
$replacements = array(
|
$replacements = array(
|
||||||
$name,
|
$name,
|
||||||
$_SERVER['PHP_SELF'].' '.$name,
|
$isSingleCommand ? $_SERVER['PHP_SELF'] : $_SERVER['PHP_SELF'].' '.$name,
|
||||||
);
|
);
|
||||||
|
|
||||||
return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
|
return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
|
||||||
|
@ -61,7 +61,7 @@ class ProcessHelper extends Helper
|
|||||||
$process = $cmd[0];
|
$process = $cmd[0];
|
||||||
unset($cmd[0]);
|
unset($cmd[0]);
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException(sprintf('Invalid command provided to "%s()": the command should an array whose first is element is either the path to the binary to run of a "Process" object.', __METHOD__));
|
throw new \InvalidArgumentException(sprintf('Invalid command provided to "%s()": the command should be an array whose first element is either the path to the binary to run or a "Process" object.', __METHOD__));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($verbosity <= $output->getVerbosity()) {
|
if ($verbosity <= $output->getVerbosity()) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -166,6 +166,14 @@ class CommandTest extends TestCase
|
|||||||
$command = new \TestCommand();
|
$command = new \TestCommand();
|
||||||
$command->setHelp('');
|
$command->setHelp('');
|
||||||
$this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description');
|
$this->assertContains('description', $command->getProcessedHelp(), '->getProcessedHelp() falls back to the description');
|
||||||
|
|
||||||
|
$command = new \TestCommand();
|
||||||
|
$command->setHelp('The %command.name% command does... Example: php %command.full_name%.');
|
||||||
|
$application = new Application();
|
||||||
|
$application->add($command);
|
||||||
|
$application->setDefaultCommand('namespace:name', true);
|
||||||
|
$this->assertContains('The namespace:name command does...', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.name% correctly in single command applications');
|
||||||
|
$this->assertNotContains('%command.full_name%', $command->getProcessedHelp(), '->getProcessedHelp() replaces %command.full_name% in single command applications');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetSetAliases()
|
public function testGetSetAliases()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -120,6 +120,9 @@ class ParserTest extends TestCase
|
|||||||
array('a[name]', array('Attribute[Element[a][name]]')),
|
array('a[name]', array('Attribute[Element[a][name]]')),
|
||||||
array("a[ name\t]", array('Attribute[Element[a][name]]')),
|
array("a[ name\t]", array('Attribute[Element[a][name]]')),
|
||||||
array('a [name]', array('CombinedSelector[Element[a] <followed> Attribute[Element[*][name]]]')),
|
array('a [name]', array('CombinedSelector[Element[a] <followed> Attribute[Element[*][name]]]')),
|
||||||
|
array('[name="foo"]', array("Attribute[Element[*][name = 'foo']]")),
|
||||||
|
array("[name='foo[1]']", array("Attribute[Element[*][name = 'foo[1]']]")),
|
||||||
|
array("[name='foo[0][bar]']", array("Attribute[Element[*][name = 'foo[0][bar]']]")),
|
||||||
array('a[rel="include"]', array("Attribute[Element[a][rel = 'include']]")),
|
array('a[rel="include"]', array("Attribute[Element[a][rel = 'include']]")),
|
||||||
array('a[rel = include]', array("Attribute[Element[a][rel = 'include']]")),
|
array('a[rel = include]', array("Attribute[Element[a][rel = 'include']]")),
|
||||||
array("a[hreflang |= 'en']", array("Attribute[Element[a][hreflang |= 'en']]")),
|
array("a[hreflang |= 'en']", array("Attribute[Element[a][hreflang |= 'en']]")),
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -565,7 +565,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
* @param string $id A service identifier
|
* @param string $id A service identifier
|
||||||
* @param string $file A parsed file
|
* @param string $file A parsed file
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException When errors are occuried
|
* @throws InvalidArgumentException When errors occur
|
||||||
*
|
*
|
||||||
* @return string|array A parsed callable
|
* @return string|array A parsed callable
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016-2018 Fabien Potencier
|
Copyright (c) 2016-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -228,7 +228,7 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
|||||||
|
|
||||||
public function reset()
|
public function reset()
|
||||||
{
|
{
|
||||||
$this->callStack = array();
|
$this->callStack = null;
|
||||||
$this->orphanedEvents = array();
|
$this->orphanedEvents = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ interface EventDispatcherInterface
|
|||||||
* @param string $eventName The name of the event to dispatch. The name of
|
* @param string $eventName The name of the event to dispatch. The name of
|
||||||
* the event is the name of the method that is
|
* the event is the name of the method that is
|
||||||
* invoked on listeners.
|
* invoked on listeners.
|
||||||
* @param Event $event The event to pass to the event handlers/listeners
|
* @param Event|null $event The event to pass to the event handlers/listeners
|
||||||
* If not supplied, an empty Event instance is created
|
* If not supplied, an empty Event instance is created
|
||||||
*
|
*
|
||||||
* @return Event
|
* @return Event
|
||||||
@ -64,7 +64,7 @@ interface EventDispatcherInterface
|
|||||||
/**
|
/**
|
||||||
* Gets the listeners of a specific event or all listeners sorted by descending priority.
|
* Gets the listeners of a specific event or all listeners sorted by descending priority.
|
||||||
*
|
*
|
||||||
* @param string $eventName The name of the event
|
* @param string|null $eventName The name of the event
|
||||||
*
|
*
|
||||||
* @return array The event listeners for the specified event, or all event listeners by event name
|
* @return array The event listeners for the specified event, or all event listeners by event name
|
||||||
*/
|
*/
|
||||||
@ -85,7 +85,7 @@ interface EventDispatcherInterface
|
|||||||
/**
|
/**
|
||||||
* Checks whether an event has any registered listeners.
|
* Checks whether an event has any registered listeners.
|
||||||
*
|
*
|
||||||
* @param string $eventName The name of the event
|
* @param string|null $eventName The name of the event
|
||||||
*
|
*
|
||||||
* @return bool true if the specified event has any listeners, false otherwise
|
* @return bool true if the specified event has any listeners, false otherwise
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -139,6 +139,18 @@ class TraceableEventDispatcherTest extends TestCase
|
|||||||
$this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
|
$this->assertEquals(array(array('event' => 'foo', 'pretty' => 'closure', 'priority' => 5)), $listeners);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testDispatchAfterReset()
|
||||||
|
{
|
||||||
|
$tdispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch());
|
||||||
|
$tdispatcher->addListener('foo', function () {}, 5);
|
||||||
|
|
||||||
|
$tdispatcher->reset();
|
||||||
|
$tdispatcher->dispatch('foo');
|
||||||
|
|
||||||
|
$listeners = $tdispatcher->getCalledListeners();
|
||||||
|
$this->assertArrayHasKey('stub', $listeners[0]);
|
||||||
|
}
|
||||||
|
|
||||||
public function testGetCalledListenersNested()
|
public function testGetCalledListenersNested()
|
||||||
{
|
{
|
||||||
$tdispatcher = null;
|
$tdispatcher = null;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -153,7 +153,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
if (null !== $this->emulateSameSite) {
|
if (null !== $this->emulateSameSite) {
|
||||||
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
|
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
|
||||||
if (null !== $originalCookie) {
|
if (null !== $originalCookie) {
|
||||||
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite));
|
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
|||||||
if (null !== $this->emulateSameSite) {
|
if (null !== $this->emulateSameSite) {
|
||||||
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
|
$originalCookie = SessionUtils::popSessionCookie(session_name(), session_id());
|
||||||
if (null !== $originalCookie) {
|
if (null !== $originalCookie) {
|
||||||
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite));
|
header(sprintf('%s; SameSite=%s', $originalCookie, $this->emulateSameSite), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ class AddAnnotatedClassesToCachePass implements CompilerPassInterface
|
|||||||
* @param array $patterns The class patterns to expand
|
* @param array $patterns The class patterns to expand
|
||||||
* @param array $classes The existing classes to match against the patterns
|
* @param array $classes The existing classes to match against the patterns
|
||||||
*
|
*
|
||||||
* @return array A list of classes derivated from the patterns
|
* @return array A list of classes derived from the patterns
|
||||||
*/
|
*/
|
||||||
private function expandClasses(array $patterns, array $classes)
|
private function expandClasses(array $patterns, array $classes)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2012-2018 Fabien Potencier
|
Copyright (c) 2012-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016-2018 Fabien Potencier
|
Copyright (c) 2016-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -46,7 +46,7 @@ interface StoreInterface
|
|||||||
*
|
*
|
||||||
* If the store does not support this feature it should throw a NotSupportedException.
|
* If the store does not support this feature it should throw a NotSupportedException.
|
||||||
*
|
*
|
||||||
* @param float $ttl amount of second to keep the lock in the store
|
* @param float $ttl amount of seconds to keep the lock in the store
|
||||||
*
|
*
|
||||||
* @throws LockConflictedException
|
* @throws LockConflictedException
|
||||||
* @throws NotSupportedException
|
* @throws NotSupportedException
|
||||||
|
@ -38,7 +38,7 @@ trait BlockingStoreTestTrait
|
|||||||
*/
|
*/
|
||||||
public function testBlockingLocks()
|
public function testBlockingLocks()
|
||||||
{
|
{
|
||||||
// Amount a microsecond used to order async actions
|
// Amount of microseconds we should wait without slowing things down too much
|
||||||
$clockDelay = 50000;
|
$clockDelay = 50000;
|
||||||
|
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
|
@ -20,7 +20,9 @@ use Symfony\Component\Lock\StoreInterface;
|
|||||||
trait ExpiringStoreTestTrait
|
trait ExpiringStoreTestTrait
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Amount a microsecond used to order async actions.
|
* Amount of microseconds used as a delay to test expiration. Should be
|
||||||
|
* small enough not to slow the test suite too much, and high enough not to
|
||||||
|
* fail because of race conditions.
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -34,7 +36,7 @@ trait ExpiringStoreTestTrait
|
|||||||
/**
|
/**
|
||||||
* Tests the store automatically delete the key when it expire.
|
* Tests the store automatically delete the key when it expire.
|
||||||
*
|
*
|
||||||
* This test is time sensible: the $clockDelay could be adjust.
|
* This test is time-sensitive: the $clockDelay could be adjusted.
|
||||||
*/
|
*/
|
||||||
public function testExpiration()
|
public function testExpiration()
|
||||||
{
|
{
|
||||||
@ -45,7 +47,7 @@ trait ExpiringStoreTestTrait
|
|||||||
$store = $this->getStore();
|
$store = $this->getStore();
|
||||||
|
|
||||||
$store->save($key);
|
$store->save($key);
|
||||||
$store->putOffExpiration($key, $clockDelay / 1000000);
|
$store->putOffExpiration($key, 2 * $clockDelay / 1000000);
|
||||||
$this->assertTrue($store->exists($key));
|
$this->assertTrue($store->exists($key));
|
||||||
|
|
||||||
usleep(3 * $clockDelay);
|
usleep(3 * $clockDelay);
|
||||||
@ -71,24 +73,23 @@ trait ExpiringStoreTestTrait
|
|||||||
/**
|
/**
|
||||||
* Tests the refresh can push the limits to the expiration.
|
* Tests the refresh can push the limits to the expiration.
|
||||||
*
|
*
|
||||||
* This test is time sensible: the $clockDelay could be adjust.
|
* This test is time-sensitive: the $clockDelay could be adjusted.
|
||||||
*/
|
*/
|
||||||
public function testRefreshLock()
|
public function testRefreshLock()
|
||||||
{
|
{
|
||||||
// Amount a microsecond used to order async actions
|
// Amount of microseconds we should wait without slowing things down too much
|
||||||
$clockDelay = $this->getClockDelay();
|
$clockDelay = $this->getClockDelay();
|
||||||
|
|
||||||
// Amount a microsecond used to order async actions
|
|
||||||
$key = new Key(uniqid(__METHOD__, true));
|
$key = new Key(uniqid(__METHOD__, true));
|
||||||
|
|
||||||
/** @var StoreInterface $store */
|
/** @var StoreInterface $store */
|
||||||
$store = $this->getStore();
|
$store = $this->getStore();
|
||||||
|
|
||||||
$store->save($key);
|
$store->save($key);
|
||||||
$store->putOffExpiration($key, $clockDelay / 1000000);
|
$store->putOffExpiration($key, 2 * $clockDelay / 1000000);
|
||||||
$this->assertTrue($store->exists($key));
|
$this->assertTrue($store->exists($key));
|
||||||
|
|
||||||
usleep(2 * $clockDelay);
|
usleep(3 * $clockDelay);
|
||||||
$this->assertFalse($store->exists($key));
|
$this->assertFalse($store->exists($key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2018 Fabien Potencier
|
Copyright (c) 2018-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -2181,9 +2181,9 @@ class OptionsResolverTest extends TestCase
|
|||||||
->setRequired(array('dbname', 'host'))
|
->setRequired(array('dbname', 'host'))
|
||||||
->setDefaults(array(
|
->setDefaults(array(
|
||||||
'port' => 3306,
|
'port' => 3306,
|
||||||
'slaves' => function (OptionsResolver $resolver) {
|
'replicas' => function (OptionsResolver $resolver) {
|
||||||
$resolver->setDefaults(array(
|
$resolver->setDefaults(array(
|
||||||
'host' => 'slave1',
|
'host' => 'replica1',
|
||||||
'port' => 3306,
|
'port' => 3306,
|
||||||
));
|
));
|
||||||
},
|
},
|
||||||
@ -2196,14 +2196,14 @@ class OptionsResolverTest extends TestCase
|
|||||||
'dbname' => 'test',
|
'dbname' => 'test',
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
'port' => null,
|
'port' => null,
|
||||||
'slaves' => array('host' => 'slave2'),
|
'replicas' => array('host' => 'replica2'),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
$expectedOptions = array(
|
$expectedOptions = array(
|
||||||
'name' => 'custom',
|
'name' => 'custom',
|
||||||
'database' => array(
|
'database' => array(
|
||||||
'port' => null,
|
'port' => null,
|
||||||
'slaves' => array('port' => 3306, 'host' => 'slave2'),
|
'replicas' => array('port' => 3306, 'host' => 'replica2'),
|
||||||
'dbname' => 'test',
|
'dbname' => 'test',
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
),
|
),
|
||||||
@ -2332,7 +2332,7 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testFailsIfCyclicDependencyBetweenSameNestedOption()
|
public function testFailsIfCyclicDependencyBetweenSameNestedOption()
|
||||||
{
|
{
|
||||||
$this->resolver->setDefault('database', function (OptionsResolver $resolver, Options $parent) {
|
$this->resolver->setDefault('database', function (OptionsResolver $resolver, Options $parent) {
|
||||||
$resolver->setDefault('slaves', $parent['database']);
|
$resolver->setDefault('replicas', $parent['database']);
|
||||||
});
|
});
|
||||||
$this->resolver->resolve();
|
$this->resolver->resolve();
|
||||||
}
|
}
|
||||||
@ -2375,9 +2375,9 @@ class OptionsResolverTest extends TestCase
|
|||||||
public function testFailsIfCyclicDependencyBetweenNestedOptions()
|
public function testFailsIfCyclicDependencyBetweenNestedOptions()
|
||||||
{
|
{
|
||||||
$this->resolver->setDefault('database', function (OptionsResolver $resolver, Options $parent) {
|
$this->resolver->setDefault('database', function (OptionsResolver $resolver, Options $parent) {
|
||||||
$resolver->setDefault('host', $parent['slave']['host']);
|
$resolver->setDefault('host', $parent['replica']['host']);
|
||||||
});
|
});
|
||||||
$this->resolver->setDefault('slave', function (OptionsResolver $resolver, Options $parent) {
|
$this->resolver->setDefault('replica', function (OptionsResolver $resolver, Options $parent) {
|
||||||
$resolver->setDefault('host', $parent['database']['host']);
|
$resolver->setDefault('host', $parent['database']['host']);
|
||||||
});
|
});
|
||||||
$this->resolver->resolve();
|
$this->resolver->resolve();
|
||||||
@ -2418,12 +2418,12 @@ class OptionsResolverTest extends TestCase
|
|||||||
'ip' => null,
|
'ip' => null,
|
||||||
'database' => function (OptionsResolver $resolver, Options $parent) {
|
'database' => function (OptionsResolver $resolver, Options $parent) {
|
||||||
$resolver->setDefault('host', $parent['ip']);
|
$resolver->setDefault('host', $parent['ip']);
|
||||||
$resolver->setDefault('master_slave', function (OptionsResolver $resolver, Options $parent) {
|
$resolver->setDefault('primary_replica', function (OptionsResolver $resolver, Options $parent) {
|
||||||
$resolver->setDefault('host', $parent['host']);
|
$resolver->setDefault('host', $parent['host']);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
'secondary_slave' => function (Options $options) {
|
'secondary_replica' => function (Options $options) {
|
||||||
return $options['database']['master_slave']['host'];
|
return $options['database']['primary_replica']['host'];
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
$actualOptions = $this->resolver->resolve(array('ip' => '127.0.0.1'));
|
$actualOptions = $this->resolver->resolve(array('ip' => '127.0.0.1'));
|
||||||
@ -2431,9 +2431,9 @@ class OptionsResolverTest extends TestCase
|
|||||||
'ip' => '127.0.0.1',
|
'ip' => '127.0.0.1',
|
||||||
'database' => array(
|
'database' => array(
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'master_slave' => array('host' => '127.0.0.1'),
|
'primary_replica' => array('host' => '127.0.0.1'),
|
||||||
),
|
),
|
||||||
'secondary_slave' => '127.0.0.1',
|
'secondary_replica' => '127.0.0.1',
|
||||||
);
|
);
|
||||||
$this->assertSame($expectedOptions, $actualOptions);
|
$this->assertSame($expectedOptions, $actualOptions);
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,10 @@ class ExecutableFinder
|
|||||||
* Finds an executable by name.
|
* Finds an executable by name.
|
||||||
*
|
*
|
||||||
* @param string $name The executable name (without the extension)
|
* @param string $name The executable name (without the extension)
|
||||||
* @param string $default The default to return if no executable is found
|
* @param string|null $default The default to return if no executable is found
|
||||||
* @param array $extraDirs Additional dirs to check into
|
* @param array $extraDirs Additional dirs to check into
|
||||||
*
|
*
|
||||||
* @return string The executable path or default value
|
* @return string|null The executable path or default value
|
||||||
*/
|
*/
|
||||||
public function find($name, $default = null, array $extraDirs = array())
|
public function find($name, $default = null, array $extraDirs = array())
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -65,6 +65,21 @@ class ExecutableFinderTest extends TestCase
|
|||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testFindWithNullAsDefault()
|
||||||
|
{
|
||||||
|
if (ini_get('open_basedir')) {
|
||||||
|
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->setPath('');
|
||||||
|
|
||||||
|
$finder = new ExecutableFinder();
|
||||||
|
|
||||||
|
$result = $finder->find('foo');
|
||||||
|
|
||||||
|
$this->assertNull($result);
|
||||||
|
}
|
||||||
|
|
||||||
public function testFindWithExtraDirs()
|
public function testFindWithExtraDirs()
|
||||||
{
|
{
|
||||||
if (ini_get('open_basedir')) {
|
if (ini_get('open_basedir')) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2015-2018 Fabien Potencier
|
Copyright (c) 2015-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -99,7 +99,7 @@ class Stopwatch implements ResetInterface
|
|||||||
* Starts an event.
|
* Starts an event.
|
||||||
*
|
*
|
||||||
* @param string $name The event name
|
* @param string $name The event name
|
||||||
* @param string $category The event category
|
* @param string|null $category The event category
|
||||||
*
|
*
|
||||||
* @return StopwatchEvent
|
* @return StopwatchEvent
|
||||||
*/
|
*/
|
||||||
|
@ -35,6 +35,14 @@ class StopwatchTest extends TestCase
|
|||||||
$this->assertSame($event, $stopwatch->getEvent('foo'));
|
$this->assertSame($event, $stopwatch->getEvent('foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testStartWithoutCategory()
|
||||||
|
{
|
||||||
|
$stopwatch = new Stopwatch();
|
||||||
|
$stopwatchEvent = $stopwatch->start('bar');
|
||||||
|
$this->assertSame('default', $stopwatchEvent->getCategory());
|
||||||
|
$this->assertSame($stopwatchEvent, $stopwatch->getEvent('bar'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testIsStarted()
|
public function testIsStarted()
|
||||||
{
|
{
|
||||||
$stopwatch = new Stopwatch();
|
$stopwatch = new Stopwatch();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -40,10 +40,10 @@ class TargetOperation extends AbstractOperation
|
|||||||
// For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``,
|
// For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``,
|
||||||
// because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
|
// because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
|
||||||
//
|
//
|
||||||
// For 'new' messages, the code can't be simplied as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));``
|
// For 'new' messages, the code can't be simplified as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));``
|
||||||
// because doing so will not exclude messages like {x: x ∈ target ∧ x ∉ source.all ∧ x ∈ source.fallback}
|
// because doing so will not exclude messages like {x: x ∈ target ∧ x ∉ source.all ∧ x ∈ source.fallback}
|
||||||
//
|
//
|
||||||
// For 'obsolete' messages, the code can't be simplifed as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))``
|
// For 'obsolete' messages, the code can't be simplified as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))``
|
||||||
// because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
|
// because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
|
||||||
|
|
||||||
foreach ($this->source->all($domain) as $id => $message) {
|
foreach ($this->source->all($domain) as $id => $message) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -127,7 +127,7 @@ class TranslatorCacheTest extends TestCase
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Similar to the previous test. After we used the second translator, make
|
* Similar to the previous test. After we used the second translator, make
|
||||||
* sure there's still a useable cache for the first one.
|
* sure there's still a usable cache for the first one.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$locale = 'any_locale';
|
$locale = 'any_locale';
|
||||||
@ -146,7 +146,7 @@ class TranslatorCacheTest extends TestCase
|
|||||||
$translator->addResource($format, array($msgid => 'FAIL'), $locale);
|
$translator->addResource($format, array($msgid => 'FAIL'), $locale);
|
||||||
$translator->trans($msgid);
|
$translator->trans($msgid);
|
||||||
|
|
||||||
// Now the first translator must still have a useable cache.
|
// Now the first translator must still have a usable cache.
|
||||||
$translator = new Translator($locale, null, $this->tmpDir, $debug);
|
$translator = new Translator($locale, null, $this->tmpDir, $debug);
|
||||||
$translator->addLoader($format, $this->createFailingLoader());
|
$translator->addLoader($format, $this->createFailingLoader());
|
||||||
$translator->addResource($format, array($msgid => 'OK'), $locale);
|
$translator->addResource($format, array($msgid => 'OK'), $locale);
|
||||||
|
@ -41,7 +41,7 @@ interface TranslatorInterface extends LocaleAwareInterface
|
|||||||
* Translates the given choice message by choosing a translation according to a number.
|
* Translates the given choice message by choosing a translation according to a number.
|
||||||
*
|
*
|
||||||
* @param string $id The message id (may also be an object that can be cast to string)
|
* @param string $id The message id (may also be an object that can be cast to string)
|
||||||
* @param int $number The number to use to find the indice of the message
|
* @param int $number The number to use to find the index of the message
|
||||||
* @param array $parameters An array of parameters for the message
|
* @param array $parameters An array of parameters for the message
|
||||||
* @param string|null $domain The domain for the message or null to use the default
|
* @param string|null $domain The domain for the message or null to use the default
|
||||||
* @param string|null $locale The locale or null to use the default
|
* @param string|null $locale The locale or null to use the default
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -30,8 +30,8 @@ class VarCloner extends AbstractCloner
|
|||||||
$queue = array(array($var)); // This breadth-first queue is the return value
|
$queue = array(array($var)); // This breadth-first queue is the return value
|
||||||
$indexedArrays = array(); // Map of queue indexes that hold numerically indexed arrays
|
$indexedArrays = array(); // Map of queue indexes that hold numerically indexed arrays
|
||||||
$hardRefs = array(); // Map of original zval ids to stub objects
|
$hardRefs = array(); // Map of original zval ids to stub objects
|
||||||
$objRefs = array(); // Map of original object handles to their stub object couterpart
|
$objRefs = array(); // Map of original object handles to their stub object counterpart
|
||||||
$resRefs = array(); // Map of original resource handles to their stub object couterpart
|
$resRefs = array(); // Map of original resource handles to their stub object counterpart
|
||||||
$values = array(); // Map of stub objects' ids to original values
|
$values = array(); // Map of stub objects' ids to original values
|
||||||
$maxItems = $this->maxItems;
|
$maxItems = $this->maxItems;
|
||||||
$maxString = $this->maxString;
|
$maxString = $this->maxString;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2014-2018 Fabien Potencier
|
Copyright (c) 2014-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -232,7 +232,7 @@ class Exporter
|
|||||||
if (!\is_int($k) || 1 !== $k - $j) {
|
if (!\is_int($k) || 1 !== $k - $j) {
|
||||||
$code .= self::export($k, $subIndent).' => ';
|
$code .= self::export($k, $subIndent).' => ';
|
||||||
}
|
}
|
||||||
if (\is_int($k)) {
|
if (\is_int($k) && $k > $j) {
|
||||||
$j = $k;
|
$j = $k;
|
||||||
}
|
}
|
||||||
$code .= self::export($v, $subIndent).",\n";
|
$code .= self::export($v, $subIndent).",\n";
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2018 Fabien Potencier
|
Copyright (c) 2018-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
5 => true,
|
||||||
|
1 => true,
|
||||||
|
2 => true,
|
||||||
|
true,
|
||||||
|
];
|
@ -112,6 +112,7 @@ class VarExporterTest extends TestCase
|
|||||||
|
|
||||||
yield array('bool', true, true);
|
yield array('bool', true, true);
|
||||||
yield array('simple-array', array(123, array('abc')), true);
|
yield array('simple-array', array(123, array('abc')), true);
|
||||||
|
yield array('partially-indexed-array', array(5 => true, 1 => true, 2 => true, 6 => true), true);
|
||||||
yield array('datetime', \DateTime::createFromFormat('U', 0));
|
yield array('datetime', \DateTime::createFromFormat('U', 0));
|
||||||
|
|
||||||
$value = new \ArrayObject();
|
$value = new \ArrayObject();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2014-2018 Fabien Potencier
|
Copyright (c) 2014-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2004-2018 Fabien Potencier
|
Copyright (c) 2004-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2018 Fabien Potencier
|
Copyright (c) 2018-2019 Fabien Potencier
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
Reference in New Issue
Block a user