Merge branch '2.7' into 2.8
Conflicts: src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php src/Symfony/Component/Security/composer.json
This commit is contained in:
commit
72365716c2
@ -149,7 +149,7 @@ EOF
|
||||
return;
|
||||
}
|
||||
$refl = new \ReflectionMethod($cb[0], $cb[1]);
|
||||
} elseif (is_object($cb) && is_callable($cb)) {
|
||||
} elseif (is_object($cb) && method_exists($cb, '__invoke')) {
|
||||
$refl = new \ReflectionMethod($cb, '__invoke');
|
||||
} elseif (function_exists($cb)) {
|
||||
$refl = new \ReflectionFunction($cb);
|
||||
|
@ -14,7 +14,7 @@
|
||||
<service id="debug.debug_handlers_listener" class="%debug.debug_handlers_listener.class%">
|
||||
<tag name="kernel.event_subscriber" />
|
||||
<tag name="monolog.logger" channel="php" />
|
||||
<argument /><!-- Exception handler -->
|
||||
<argument>null</argument><!-- Exception handler -->
|
||||
<argument type="service" id="logger" on-invalid="null" />
|
||||
<argument>null</argument><!-- Log levels map for enabled error levels -->
|
||||
<argument>null</argument>
|
||||
|
@ -137,15 +137,17 @@ class ApplicationDescription
|
||||
private function sortCommands(array $commands)
|
||||
{
|
||||
$namespacedCommands = array();
|
||||
$globalCommands = array();
|
||||
foreach ($commands as $name => $command) {
|
||||
$key = $this->application->extractNamespace($name, 1);
|
||||
if (!$key) {
|
||||
$key = '_global';
|
||||
$globalCommands['_global'][$name] = $command;
|
||||
} else {
|
||||
$namespacedCommands[$key][$name] = $command;
|
||||
}
|
||||
|
||||
$namespacedCommands[$key][$name] = $command;
|
||||
}
|
||||
ksort($namespacedCommands);
|
||||
$namespacedCommands = array_merge($globalCommands, $namespacedCommands);
|
||||
|
||||
foreach ($namespacedCommands as &$commandsSet) {
|
||||
ksort($commandsSet);
|
||||
|
@ -220,7 +220,7 @@ class Question
|
||||
*
|
||||
* The normalizer can be a callable (a string), a closure or a class implementing __invoke.
|
||||
*
|
||||
* @param string|\Closure $normalizer
|
||||
* @param callable $normalizer
|
||||
*
|
||||
* @return Question The current instance
|
||||
*/
|
||||
@ -236,7 +236,7 @@ class Question
|
||||
*
|
||||
* The normalizer can ba a callable (a string), a closure or a class implementing __invoke.
|
||||
*
|
||||
* @return string|\Closure
|
||||
* @return callable
|
||||
*/
|
||||
public function getNormalizer()
|
||||
{
|
||||
|
@ -61,4 +61,52 @@ EOF;
|
||||
|
||||
$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:
|
||||
-h, --help Display this help message
|
||||
-q, --quiet Do not output any message
|
||||
-V, --version Display this application version
|
||||
--ansi Force ANSI output
|
||||
--no-ansi Disable ANSI output
|
||||
-n, --no-interaction Do not ask any interactive question
|
||||
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
|
||||
|
||||
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.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param array $filters An array of PHP callbacks
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param callable[] $filters An array of PHP callbacks
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
@ -131,7 +131,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
*
|
||||
* @param string $controller A Controller string
|
||||
*
|
||||
* @return mixed A PHP callable
|
||||
* @return callable A PHP callable
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
@ -29,8 +29,6 @@ class FilterControllerEvent extends KernelEvent
|
||||
{
|
||||
/**
|
||||
* The current controller.
|
||||
*
|
||||
* @var callable
|
||||
*/
|
||||
private $controller;
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ class Process
|
||||
*
|
||||
* @param callable|null $callback The user defined PHP callback
|
||||
*
|
||||
* @return callable A PHP callable
|
||||
* @return \Closure A PHP closure
|
||||
*/
|
||||
protected function buildCallback($callback)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="2">
|
||||
<source>Authentication credentials could not be found.</source>
|
||||
<target>Yetkilendirme girdileri bulunamadı.</target>
|
||||
<target>Kimlik bilgileri bulunamadı.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="3">
|
||||
<source>Authentication request could not be processed due to a system problem.</source>
|
||||
@ -16,7 +16,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="4">
|
||||
<source>Invalid credentials.</source>
|
||||
<target>Geçersiz girdiler.</target>
|
||||
<target>Geçersiz kimlik bilgileri.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="5">
|
||||
<source>Cookie has already been used by someone else.</source>
|
||||
@ -32,7 +32,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="8">
|
||||
<source>Digest nonce has expired.</source>
|
||||
<target>Derleme zaman aşımı gerçekleşti.</target>
|
||||
<target>Derleme zaman aşımına uğradı.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="9">
|
||||
<source>No authentication provider found to support the authentication token.</source>
|
||||
@ -44,7 +44,7 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="11">
|
||||
<source>No token could be found.</source>
|
||||
<target>Bilet bulunamadı.</target>
|
||||
<target>Fiş bulunamadı.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="12">
|
||||
<source>Username could not be found.</source>
|
||||
@ -56,11 +56,11 @@
|
||||
</trans-unit>
|
||||
<trans-unit id="14">
|
||||
<source>Credentials have expired.</source>
|
||||
<target>Girdiler zaman aşımına uğradı.</target>
|
||||
<target>Kimlik bilgileri zaman aşımına uğradı.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="15">
|
||||
<source>Account is disabled.</source>
|
||||
<target>Hesap devre dışı bırakılmış.</target>
|
||||
<target>Hesap engellenmiş.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="16">
|
||||
<source>Account is locked.</source>
|
||||
|
@ -102,7 +102,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase
|
||||
protected function getVoterFor2Roles($token, $vote1, $vote2)
|
||||
{
|
||||
$voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface');
|
||||
$voter->expects($this->exactly(2))
|
||||
$voter->expects($this->any())
|
||||
->method('vote')
|
||||
->will($this->returnValueMap(array(
|
||||
array($token, null, array('ROLE_FOO'), $vote1),
|
||||
|
@ -35,7 +35,10 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
|
||||
const COOKIE_DELIMITER = ':';
|
||||
|
||||
protected $logger;
|
||||
protected $options;
|
||||
protected $options = array(
|
||||
'secure' => false,
|
||||
'httponly' => true,
|
||||
);
|
||||
private $providerKey;
|
||||
private $secret;
|
||||
private $userProviders;
|
||||
@ -66,7 +69,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
|
||||
$this->userProviders = $userProviders;
|
||||
$this->secret = $secret;
|
||||
$this->providerKey = $providerKey;
|
||||
$this->options = $options;
|
||||
$this->options = array_merge($this->options, $options);
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
@ -91,11 +91,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
|
||||
$service->logout($request, $response, $token);
|
||||
|
||||
$cookie = $request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME);
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Cookie', $cookie);
|
||||
$this->assertTrue($cookie->isCleared());
|
||||
$this->assertSame($options['name'], $cookie->getName());
|
||||
@ -286,13 +283,6 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
$userProvider = $this->getProvider();
|
||||
}
|
||||
|
||||
if (!isset($options['secure'])) {
|
||||
$options['secure'] = false;
|
||||
}
|
||||
if (!isset($options['httponly'])) {
|
||||
$options['httponly'] = true;
|
||||
}
|
||||
|
||||
return $this->getMockForAbstractClass('Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices', array(
|
||||
array($userProvider), 'foosecret', 'fookey', $options, $logger,
|
||||
));
|
||||
|
@ -313,13 +313,6 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
$userProvider = $this->getProvider();
|
||||
}
|
||||
|
||||
if (!isset($options['secure'])) {
|
||||
$options['secure'] = false;
|
||||
}
|
||||
if (!isset($options['httponly'])) {
|
||||
$options['httponly'] = true;
|
||||
}
|
||||
|
||||
return new PersistentTokenBasedRememberMeServices(array($userProvider), 'foosecret', 'fookey', $options, $logger, new SecureRandom(sys_get_temp_dir().'/_sf2.seed'));
|
||||
}
|
||||
|
||||
|
@ -266,13 +266,6 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
$userProvider = $this->getProvider();
|
||||
}
|
||||
|
||||
if (!isset($options['secure'])) {
|
||||
$options['secure'] = false;
|
||||
}
|
||||
if (!isset($options['httponly'])) {
|
||||
$options['httponly'] = true;
|
||||
}
|
||||
|
||||
$service = new TokenBasedRememberMeServices(array($userProvider), 'foosecret', 'fookey', $options, $logger);
|
||||
|
||||
return $service;
|
||||
|
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Security\Tests;
|
||||
|
||||
use Symfony\Component\Finder\Finder;
|
||||
|
||||
class TranslationSyncStatusTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider getTranslationDirectoriesData
|
||||
*/
|
||||
public function testTranslationFileIsNotMissingInCore($dir1, $dir2)
|
||||
{
|
||||
$finder = new Finder();
|
||||
$files = $finder->in($dir1)->files();
|
||||
|
||||
foreach ($files as $file) {
|
||||
$this->assertFileExists($dir2.'/'.$file->getFilename(), 'Missing file '.$file->getFilename().' in directory '.$dir2);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTranslationDirectoriesData()
|
||||
{
|
||||
$legacyTranslationsDir = $this->getLegacyTranslationsDirectory();
|
||||
$coreTranslationsDir = $this->getCoreTranslationsDirectory();
|
||||
|
||||
return array(
|
||||
'file-not-missing-in-core' => array($legacyTranslationsDir, $coreTranslationsDir),
|
||||
'file-not-added-in-core' => array($coreTranslationsDir, $legacyTranslationsDir),
|
||||
);
|
||||
}
|
||||
|
||||
public function testFileContentsAreEqual()
|
||||
{
|
||||
$finder = new Finder();
|
||||
$files = $finder->in($this->getLegacyTranslationsDirectory())->files();
|
||||
|
||||
foreach ($files as $file) {
|
||||
$coreFile = $this->getCoreTranslationsDirectory().'/'.$file->getFilename();
|
||||
|
||||
$this->assertFileEquals($file->getRealPath(), $coreFile, $file.' and '.$coreFile.' have equal content.');
|
||||
}
|
||||
}
|
||||
|
||||
private function getLegacyTranslationsDirectory()
|
||||
{
|
||||
return __DIR__.'/../Resources/translations';
|
||||
}
|
||||
|
||||
private function getCoreTranslationsDirectory()
|
||||
{
|
||||
return __DIR__.'/../Core/Resources/translations';
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@
|
||||
"symfony/security-http": "self.version"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/finder": "~2.3|~3.0.0",
|
||||
"symfony/phpunit-bridge": "~2.7|~3.0.0",
|
||||
"symfony/intl": "~2.3|~3.0.0",
|
||||
"symfony/routing": "~2.2|~3.0.0",
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Symfony Security Component Test Suite">
|
||||
<directory>./Tests/</directory>
|
||||
<directory>./Acl/Tests/</directory>
|
||||
<directory>./Core/Tests/</directory>
|
||||
<directory>./Http/Tests/</directory>
|
||||
@ -24,6 +25,7 @@
|
||||
<directory>./</directory>
|
||||
<exclude>
|
||||
<directory>./vendor</directory>
|
||||
<directory>./Tests</directory>
|
||||
<directory>./Acl/Tests</directory>
|
||||
<directory>./Core/Tests</directory>
|
||||
<directory>./Http/Tests</directory>
|
||||
|
@ -105,7 +105,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N
|
||||
/**
|
||||
* Set normalization callbacks.
|
||||
*
|
||||
* @param array $callbacks help normalize the result
|
||||
* @param callable[] $callbacks help normalize the result
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
|
@ -350,8 +350,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess
|
||||
/**
|
||||
* Adds an escaper for the given context.
|
||||
*
|
||||
* @param string $context The escaper context (html, js, ...)
|
||||
* @param mixed $escaper A PHP callable
|
||||
* @param string $context The escaper context (html, js, ...)
|
||||
* @param callable $escaper A PHP callable
|
||||
*/
|
||||
public function setEscaper($context, $escaper)
|
||||
{
|
||||
@ -364,7 +364,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess
|
||||
*
|
||||
* @param string $context The context name
|
||||
*
|
||||
* @return mixed $escaper A PHP callable
|
||||
* @return callable $escaper A PHP callable
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
|
@ -189,8 +189,8 @@ class PluralizationRules
|
||||
/**
|
||||
* Overrides the default plural rule for a given locale.
|
||||
*
|
||||
* @param string $rule A PHP callable
|
||||
* @param string $locale The locale
|
||||
* @param callable $rule A PHP callable
|
||||
* @param string $locale The locale
|
||||
*
|
||||
* @throws \LogicException
|
||||
*/
|
||||
|
Reference in New Issue
Block a user