diff options
-rw-r--r-- | Core/Resources/translations/security.az.xlf | 71 | ||||
-rw-r--r-- | Core/Resources/translations/security.he.xlf | 71 | ||||
-rw-r--r-- | Http/RememberMe/AbstractRememberMeServices.php | 7 | ||||
-rw-r--r-- | Tests/Acl/Dbal/AclProviderTest.php | 7 | ||||
-rw-r--r-- | Tests/Acl/Dbal/MutableAclProviderTest.php | 7 | ||||
-rw-r--r-- | Tests/Core/Encoder/BCryptPasswordEncoderTest.php | 17 | ||||
-rw-r--r-- | Tests/Core/SecurityContextTest.php | 5 | ||||
-rw-r--r-- | Tests/Http/HttpUtilsTest.php | 3 | ||||
-rw-r--r-- | Tests/Http/RememberMe/AbstractRememberMeServicesTest.php | 10 | ||||
-rw-r--r-- | Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php | 7 | ||||
-rw-r--r-- | Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php | 7 | ||||
-rw-r--r-- | composer.json | 1 |
12 files changed, 24 insertions, 189 deletions
diff --git a/Core/Resources/translations/security.az.xlf b/Core/Resources/translations/security.az.xlf deleted file mode 100644 index a974ed0..0000000 --- a/Core/Resources/translations/security.az.xlf +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1"> - <source>An authentication exception occurred.</source> - <target>Doğrulama istisnası baş verdi.</target> - </trans-unit> - <trans-unit id="2"> - <source>Authentication credentials could not be found.</source> - <target>Doğrulama məlumatları tapılmadı.</target> - </trans-unit> - <trans-unit id="3"> - <source>Authentication request could not be processed due to a system problem.</source> - <target>Sistem xətası səbəbilə doğrulama istəyi emal edilə bilmədi.</target> - </trans-unit> - <trans-unit id="4"> - <source>Invalid credentials.</source> - <target>Yanlış məlumat.</target> - </trans-unit> - <trans-unit id="5"> - <source>Cookie has already been used by someone else.</source> - <target>Kuki başqası tərəfindən istifadə edilib.</target> - </trans-unit> - <trans-unit id="6"> - <source>Not privileged to request the resource.</source> - <target>Resurs istəyi üçün imtiyaz yoxdur.</target> - </trans-unit> - <trans-unit id="7"> - <source>Invalid CSRF token.</source> - <target>Yanlış CSRF nişanı.</target> - </trans-unit> - <trans-unit id="8"> - <source>Digest nonce has expired.</source> - <target>Dərləmə istifadə müddəti bitib.</target> - </trans-unit> - <trans-unit id="9"> - <source>No authentication provider found to support the authentication token.</source> - <target>Doğrulama nişanını dəstəkləyəcək provayder tapılmadı.</target> - </trans-unit> - <trans-unit id="10"> - <source>No session available, it either timed out or cookies are not enabled.</source> - <target>Uyğun seans yoxdur, vaxtı keçib və ya kuki aktiv deyil.</target> - </trans-unit> - <trans-unit id="11"> - <source>No token could be found.</source> - <target>Nişan tapılmadı.</target> - </trans-unit> - <trans-unit id="12"> - <source>Username could not be found.</source> - <target>İstifadəçi adı tapılmadı.</target> - </trans-unit> - <trans-unit id="13"> - <source>Account has expired.</source> - <target>Hesabın istifadə müddəti bitib.</target> - </trans-unit> - <trans-unit id="14"> - <source>Credentials have expired.</source> - <target>Məlumatların istifadə müddəti bitib.</target> - </trans-unit> - <trans-unit id="15"> - <source>Account is disabled.</source> - <target>Hesab qeyri-aktiv edilib.</target> - </trans-unit> - <trans-unit id="16"> - <source>Account is locked.</source> - <target>Hesab kilitlənib.</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/Core/Resources/translations/security.he.xlf b/Core/Resources/translations/security.he.xlf deleted file mode 100644 index 3640698..0000000 --- a/Core/Resources/translations/security.he.xlf +++ /dev/null @@ -1,71 +0,0 @@ -<?xml version="1.0"?> -<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"> - <file source-language="en" datatype="plaintext" original="file.ext"> - <body> - <trans-unit id="1"> - <source>An authentication exception occurred.</source> - <target>An authentication exception occurred.</target> - </trans-unit> - <trans-unit id="2"> - <source>Authentication credentials could not be found.</source> - <target>Authentication credentials could not be found.</target> - </trans-unit> - <trans-unit id="3"> - <source>Authentication request could not be processed due to a system problem.</source> - <target>Authentication request could not be processed due to a system problem.</target> - </trans-unit> - <trans-unit id="4"> - <source>Invalid credentials.</source> - <target>Invalid credentials.</target> - </trans-unit> - <trans-unit id="5"> - <source>Cookie has already been used by someone else.</source> - <target>Cookie has already been used by someone else.</target> - </trans-unit> - <trans-unit id="6"> - <source>Not privileged to request the resource.</source> - <target>Not privileged to request the resource.</target> - </trans-unit> - <trans-unit id="7"> - <source>Invalid CSRF token.</source> - <target>Invalid CSRF token.</target> - </trans-unit> - <trans-unit id="8"> - <source>Digest nonce has expired.</source> - <target>Digest nonce has expired.</target> - </trans-unit> - <trans-unit id="9"> - <source>No authentication provider found to support the authentication token.</source> - <target>No authentication provider found to support the authentication token.</target> - </trans-unit> - <trans-unit id="10"> - <source>No session available, it either timed out or cookies are not enabled.</source> - <target>No session available, it either timed out or cookies are not enabled.</target> - </trans-unit> - <trans-unit id="11"> - <source>No token could be found.</source> - <target>No token could be found.</target> - </trans-unit> - <trans-unit id="12"> - <source>Username could not be found.</source> - <target>Username could not be found.</target> - </trans-unit> - <trans-unit id="13"> - <source>Account has expired.</source> - <target>Account has expired.</target> - </trans-unit> - <trans-unit id="14"> - <source>Credentials have expired.</source> - <target>Credentials have expired.</target> - </trans-unit> - <trans-unit id="15"> - <source>Account is disabled.</source> - <target>Account is disabled.</target> - </trans-unit> - <trans-unit id="16"> - <source>Account is locked.</source> - <target>Account is locked.</target> - </trans-unit> - </body> - </file> -</xliff> diff --git a/Http/RememberMe/AbstractRememberMeServices.php b/Http/RememberMe/AbstractRememberMeServices.php index 51eddb6..be22a1d 100644 --- a/Http/RememberMe/AbstractRememberMeServices.php +++ b/Http/RememberMe/AbstractRememberMeServices.php @@ -34,7 +34,10 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface const COOKIE_DELIMITER = ':'; protected $logger; - protected $options; + protected $options = array( + 'secure' => false, + 'httponly' => true, + ); private $providerKey; private $key; private $userProviders; @@ -65,7 +68,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface $this->userProviders = $userProviders; $this->key = $key; $this->providerKey = $providerKey; - $this->options = $options; + $this->options = array_merge($this->options, $options); $this->logger = $logger; } diff --git a/Tests/Acl/Dbal/AclProviderTest.php b/Tests/Acl/Dbal/AclProviderTest.php index 7ca493f..afbcb56 100644 --- a/Tests/Acl/Dbal/AclProviderTest.php +++ b/Tests/Acl/Dbal/AclProviderTest.php @@ -17,6 +17,9 @@ use Symfony\Component\Security\Acl\Domain\ObjectIdentity; use Symfony\Component\Security\Acl\Dbal\Schema; use Doctrine\DBAL\DriverManager; +/** + * @requires extension pdo_sqlite + */ class AclProviderTest extends \PHPUnit_Framework_TestCase { protected $con; @@ -141,10 +144,6 @@ class AclProviderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { - self::markTestSkipped('This test requires SQLite support in your environment'); - } - $this->con = DriverManager::getConnection(array( 'driver' => 'pdo_sqlite', 'memory' => true, diff --git a/Tests/Acl/Dbal/MutableAclProviderTest.php b/Tests/Acl/Dbal/MutableAclProviderTest.php index 00500f8..3213406 100644 --- a/Tests/Acl/Dbal/MutableAclProviderTest.php +++ b/Tests/Acl/Dbal/MutableAclProviderTest.php @@ -27,6 +27,9 @@ use Symfony\Component\Security\Acl\Dbal\Schema; use Doctrine\DBAL\DriverManager; use Symfony\Component\Security\Acl\Domain\ObjectIdentity; +/** + * @requires extension pdo_sqlite + */ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase { protected $con; @@ -483,10 +486,6 @@ class MutableAclProviderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { - self::markTestSkipped('This test requires SQLite support in your environment'); - } - $this->con = DriverManager::getConnection(array( 'driver' => 'pdo_sqlite', 'memory' => true, diff --git a/Tests/Core/Encoder/BCryptPasswordEncoderTest.php b/Tests/Core/Encoder/BCryptPasswordEncoderTest.php index 3f8ba86..076d954 100644 --- a/Tests/Core/Encoder/BCryptPasswordEncoderTest.php +++ b/Tests/Core/Encoder/BCryptPasswordEncoderTest.php @@ -45,32 +45,27 @@ class BCryptPasswordEncoderTest extends \PHPUnit_Framework_TestCase } } + /** + * @requires PHP 5.3.7 + */ public function testResultLength() { - $this->skipIfPhpVersionIsNotSupported(); - $encoder = new BCryptPasswordEncoder(self::VALID_COST); $result = $encoder->encodePassword(self::PASSWORD, null); $this->assertEquals(60, strlen($result)); } + /** + * @requires PHP 5.3.7 + */ public function testValidation() { - $this->skipIfPhpVersionIsNotSupported(); - $encoder = new BCryptPasswordEncoder(self::VALID_COST); $result = $encoder->encodePassword(self::PASSWORD, null); $this->assertTrue($encoder->isPasswordValid($result, self::PASSWORD, null)); $this->assertFalse($encoder->isPasswordValid($result, 'anotherPassword', null)); } - private function skipIfPhpVersionIsNotSupported() - { - if (PHP_VERSION_ID < 50307) { - $this->markTestSkipped('Requires PHP >= 5.3.7'); - } - } - /** * @expectedException \Symfony\Component\Security\Core\Exception\BadCredentialsException */ diff --git a/Tests/Core/SecurityContextTest.php b/Tests/Core/SecurityContextTest.php index 124ebf9..6695889 100644 --- a/Tests/Core/SecurityContextTest.php +++ b/Tests/Core/SecurityContextTest.php @@ -89,4 +89,9 @@ class SecurityContextTest extends \PHPUnit_Framework_TestCase $context->setToken($token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')); $this->assertSame($token, $context->getToken()); } + + public function testTranslationsAreNotInCore() + { + $this->assertFalse(file_exists(__DIR__.'/../../Core/Resources/translations/')); + } } diff --git a/Tests/Http/HttpUtilsTest.php b/Tests/Http/HttpUtilsTest.php index 019af19..4a69242 100644 --- a/Tests/Http/HttpUtilsTest.php +++ b/Tests/Http/HttpUtilsTest.php @@ -14,6 +14,7 @@ namespace Symfony\Component\Security\Tests\Http; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\SecurityContextInterface; use Symfony\Component\Security\Http\HttpUtils; @@ -43,7 +44,7 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase $urlGenerator ->expects($this->any()) ->method('generate') - ->with('foobar', array(), true) + ->with('foobar', array(), UrlGeneratorInterface::ABSOLUTE_URL) ->will($this->returnValue('http://localhost/foo/bar')) ; $urlGenerator diff --git a/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php b/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php index 9dbcf3f..c98b6b4 100644 --- a/Tests/Http/RememberMe/AbstractRememberMeServicesTest.php +++ b/Tests/Http/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), 'fookey', 'fookey', $options, $logger, )); diff --git a/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php index fe64abc..61c3559 100644 --- a/Tests/Http/RememberMe/PersistentTokenBasedRememberMeServicesTest.php +++ b/Tests/Http/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), 'fookey', 'fookey', $options, $logger, new SecureRandom(sys_get_temp_dir().'/_sf2.seed')); } diff --git a/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php b/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php index 929680d..b988c7d 100644 --- a/Tests/Http/RememberMe/TokenBasedRememberMeServicesTest.php +++ b/Tests/Http/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), 'fookey', 'fookey', $options, $logger); return $service; diff --git a/composer.json b/composer.json index 4c2b070..bc15cc8 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,6 @@ "symfony/http-kernel": "~2.1" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7", "symfony/form": "~2.0,>=2.0.5", "symfony/intl": "~2.3", "symfony/routing": "~2.2", |