Merge branch '2.3' into 2.7
Conflicts: src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php src/Symfony/Bundle/SecurityBundle/composer.json src/Symfony/Component/Process/Process.php
This commit is contained in:
commit
209047ea79
@ -683,7 +683,16 @@ class FrameworkExtension extends Extension
|
|||||||
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
||||||
|
|
||||||
$dirs[] = dirname($r->getFileName()).'/../Resources/translations';
|
$legacyTranslationsDir = dirname($r->getFilename()).'/../../Resources/translations';
|
||||||
|
|
||||||
|
if (file_exists($legacyTranslationsDir)) {
|
||||||
|
// in Symfony 2.3, translations are located in the symfony/security package
|
||||||
|
$dirs[] = $legacyTranslationsDir;
|
||||||
|
} else {
|
||||||
|
// with Symfony 2.4, the Security component was split into several subpackages
|
||||||
|
// and the translations have been moved to the symfony/security-core package
|
||||||
|
$dirs[] = dirname($r->getFilename()).'/../Resources/translations';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
|
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
|
||||||
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
||||||
|
@ -136,15 +136,17 @@ class ApplicationDescription
|
|||||||
private function sortCommands(array $commands)
|
private function sortCommands(array $commands)
|
||||||
{
|
{
|
||||||
$namespacedCommands = array();
|
$namespacedCommands = array();
|
||||||
|
$globalCommands = array();
|
||||||
foreach ($commands as $name => $command) {
|
foreach ($commands as $name => $command) {
|
||||||
$key = $this->application->extractNamespace($name, 1);
|
$key = $this->application->extractNamespace($name, 1);
|
||||||
if (!$key) {
|
if (!$key) {
|
||||||
$key = '_global';
|
$globalCommands['_global'][$name] = $command;
|
||||||
|
} else {
|
||||||
|
$namespacedCommands[$key][$name] = $command;
|
||||||
}
|
}
|
||||||
|
|
||||||
$namespacedCommands[$key][$name] = $command;
|
|
||||||
}
|
}
|
||||||
ksort($namespacedCommands);
|
ksort($namespacedCommands);
|
||||||
|
$namespacedCommands = array_merge($globalCommands, $namespacedCommands);
|
||||||
|
|
||||||
foreach ($namespacedCommands as &$commandsSet) {
|
foreach ($namespacedCommands as &$commandsSet) {
|
||||||
ksort($commandsSet);
|
ksort($commandsSet);
|
||||||
|
@ -61,4 +61,52 @@ EOF;
|
|||||||
|
|
||||||
$this->assertEquals($output, $commandTester->getDisplay(true));
|
$this->assertEquals($output, $commandTester->getDisplay(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testExecuteListsCommandsOrder()
|
||||||
|
{
|
||||||
|
require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php');
|
||||||
|
$application = new Application();
|
||||||
|
$application->add(new \Foo6Command());
|
||||||
|
$commandTester = new CommandTester($command = $application->get('list'));
|
||||||
|
$commandTester->execute(array('command' => $command->getName()), array('decorated' => false));
|
||||||
|
$output = <<<EOF
|
||||||
|
Console Tool
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
command [options] [arguments]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
--help -h Display this help message
|
||||||
|
--quiet -q Do not output any message
|
||||||
|
--verbose -v|vv|vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||||
|
--version -V Display this application version
|
||||||
|
--ansi Force ANSI output
|
||||||
|
--no-ansi Disable ANSI output
|
||||||
|
--no-interaction -n Do not ask any interactive question
|
||||||
|
|
||||||
|
Available commands:
|
||||||
|
help Displays help for a command
|
||||||
|
list Lists commands
|
||||||
|
0foo
|
||||||
|
0foo:bar 0foo:bar command
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$this->assertEquals($output, trim($commandTester->getDisplay(true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testExecuteListsCommandsOrderRaw()
|
||||||
|
{
|
||||||
|
require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php');
|
||||||
|
$application = new Application();
|
||||||
|
$application->add(new \Foo6Command());
|
||||||
|
$commandTester = new CommandTester($command = $application->get('list'));
|
||||||
|
$commandTester->execute(array('command' => $command->getName(), '--raw' => true));
|
||||||
|
$output = <<<EOF
|
||||||
|
help Displays help for a command
|
||||||
|
list Lists commands
|
||||||
|
0foo:bar 0foo:bar command
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$this->assertEquals($output, trim($commandTester->getDisplay(true)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
12
src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php
Normal file
12
src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
|
||||||
|
class Foo6Command extends Command
|
||||||
|
{
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this->setName('0foo:bar')->setDescription('0foo:bar command');
|
||||||
|
}
|
||||||
|
}
|
@ -26,8 +26,8 @@ class CustomFilterIterator extends FilterIterator
|
|||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param \Iterator $iterator The Iterator to filter
|
* @param \Iterator $iterator The Iterator to filter
|
||||||
* @param array $filters An array of PHP callbacks
|
* @param callable[] $filters An array of PHP callbacks
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +131,7 @@ class ControllerResolver implements ControllerResolverInterface
|
|||||||
*
|
*
|
||||||
* @param string $controller A Controller string
|
* @param string $controller A Controller string
|
||||||
*
|
*
|
||||||
* @return mixed A PHP callable
|
* @return callable A PHP callable
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -29,8 +29,6 @@ class FilterControllerEvent extends KernelEvent
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The current controller.
|
* The current controller.
|
||||||
*
|
|
||||||
* @var callable
|
|
||||||
*/
|
*/
|
||||||
private $controller;
|
private $controller;
|
||||||
|
|
||||||
|
@ -1270,7 +1270,7 @@ class Process
|
|||||||
*
|
*
|
||||||
* @param callable|null $callback The user defined PHP callback
|
* @param callable|null $callback The user defined PHP callback
|
||||||
*
|
*
|
||||||
* @return callable A PHP callable
|
* @return \Closure A PHP closure
|
||||||
*/
|
*/
|
||||||
protected function buildCallback($callback)
|
protected function buildCallback($callback)
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function getVoterFor2Roles($token, $vote1, $vote2)
|
protected function getVoterFor2Roles($token, $vote1, $vote2)
|
||||||
{
|
{
|
||||||
$voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
|
$voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
|
||||||
$voter->expects($this->exactly(2))
|
$voter->expects($this->any())
|
||||||
->method('vote')
|
->method('vote')
|
||||||
->will($this->returnValueMap(array(
|
->will($this->returnValueMap(array(
|
||||||
array($token, null, array('ROLE_FOO'), $vote1),
|
array($token, null, array('ROLE_FOO'), $vote1),
|
||||||
|
@ -350,8 +350,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
|
|||||||
/**
|
/**
|
||||||
* Adds an escaper for the given context.
|
* Adds an escaper for the given context.
|
||||||
*
|
*
|
||||||
* @param string $context The escaper context (html, js, ...)
|
* @param string $context The escaper context (html, js, ...)
|
||||||
* @param mixed $escaper A PHP callable
|
* @param callable $escaper A PHP callable
|
||||||
*/
|
*/
|
||||||
public function setEscaper($context, $escaper)
|
public function setEscaper($context, $escaper)
|
||||||
{
|
{
|
||||||
@ -364,7 +364,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess
|
|||||||
*
|
*
|
||||||
* @param string $context The context name
|
* @param string $context The context name
|
||||||
*
|
*
|
||||||
* @return mixed $escaper A PHP callable
|
* @return callable $escaper A PHP callable
|
||||||
*
|
*
|
||||||
* @throws \InvalidArgumentException
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
|
@ -189,8 +189,8 @@ class PluralizationRules
|
|||||||
/**
|
/**
|
||||||
* Overrides the default plural rule for a given locale.
|
* Overrides the default plural rule for a given locale.
|
||||||
*
|
*
|
||||||
* @param string $rule A PHP callable
|
* @param callable $rule A PHP callable
|
||||||
* @param string $locale The locale
|
* @param string $locale The locale
|
||||||
*
|
*
|
||||||
* @throws \LogicException
|
* @throws \LogicException
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user