summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Grekas <nicolas.grekas@gmail.com>2015-10-06 19:12:59 +0200
committerNicolas Grekas <nicolas.grekas@gmail.com>2015-10-06 19:12:59 +0200
commitce07ac56f610bc9ca1ef11fddf90d38d3b72f85e (patch)
tree5cce7f9ba7469c8ee4577a0b8ca3c8abe940f9ab
parent99d73ecb12dedf5c772aab7f00e7d39b60c5f4ed (diff)
parent13818e3015a2a20025ae65b6f57756795eaeda7e (diff)
downloadsymfony-security-ce07ac56f610bc9ca1ef11fddf90d38d3b72f85e.zip
symfony-security-ce07ac56f610bc9ca1ef11fddf90d38d3b72f85e.tar.gz
symfony-security-ce07ac56f610bc9ca1ef11fddf90d38d3b72f85e.tar.bz2
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
-rw-r--r--Core/Resources/translations/security.tr.xlf12
-rw-r--r--Core/Tests/Authorization/AccessDecisionManagerTest.php2
-rw-r--r--Http/RememberMe/AbstractRememberMeServices.php7
-rw-r--r--Http/Tests/RememberMe/AbstractRememberMeServicesTest.php10
-rw-r--r--Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php7
-rw-r--r--Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php7
-rw-r--r--Tests/TranslationSyncStatusTest.php63
-rw-r--r--composer.json1
-rw-r--r--phpunit.xml.dist2
9 files changed, 78 insertions, 33 deletions
diff --git a/Core/Resources/translations/security.tr.xlf b/Core/Resources/translations/security.tr.xlf
index fbf9b26..68c4421 100644
--- a/Core/Resources/translations/security.tr.xlf
+++ b/Core/Resources/translations/security.tr.xlf
@@ -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>
diff --git a/Core/Tests/Authorization/AccessDecisionManagerTest.php b/Core/Tests/Authorization/AccessDecisionManagerTest.php
index 08bbc58..412af91 100644
--- a/Core/Tests/Authorization/AccessDecisionManagerTest.php
+++ b/Core/Tests/Authorization/AccessDecisionManagerTest.php
@@ -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),
diff --git a/Http/RememberMe/AbstractRememberMeServices.php b/Http/RememberMe/AbstractRememberMeServices.php
index 3638f0c..8627bc8 100644
--- a/Http/RememberMe/AbstractRememberMeServices.php
+++ b/Http/RememberMe/AbstractRememberMeServices.php
@@ -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;
}
diff --git a/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php b/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
index 4ea4f5d..7495398 100644
--- a/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
+++ b/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php
@@ -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,
));
diff --git a/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
index 43aaf92..502d170 100644
--- a/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
+++ b/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php
@@ -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'));
}
diff --git a/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php b/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php
index dab811b..f1fb897 100644
--- a/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php
+++ b/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php
@@ -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;
diff --git a/Tests/TranslationSyncStatusTest.php b/Tests/TranslationSyncStatusTest.php
new file mode 100644
index 0000000..4b72d41
--- /dev/null
+++ b/Tests/TranslationSyncStatusTest.php
@@ -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';
+ }
+}
diff --git a/composer.json b/composer.json
index ad0ea41..8a58520 100644
--- a/composer.json
+++ b/composer.json
@@ -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",
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index c0dbb2d..0d9fe5f 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -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>