diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Http/Firewall/UsernamePasswordFormAuthenticationListenerTest.php | 8 | ||||
-rw-r--r-- | Tests/Resources/TranslationFilesTest.php | 31 | ||||
-rw-r--r-- | Tests/TranslationSyncStatusTest.php | 63 |
3 files changed, 4 insertions, 98 deletions
diff --git a/Tests/Http/Firewall/UsernamePasswordFormAuthenticationListenerTest.php b/Tests/Http/Firewall/UsernamePasswordFormAuthenticationListenerTest.php index 3e65b09..22ba421 100644 --- a/Tests/Http/Firewall/UsernamePasswordFormAuthenticationListenerTest.php +++ b/Tests/Http/Firewall/UsernamePasswordFormAuthenticationListenerTest.php @@ -14,7 +14,7 @@ namespace Symfony\Component\Security\Tests\Http\Firewall; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Security\Http\Firewall\UsernamePasswordFormAuthenticationListener; -use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\Security\Core\Security; class UsernamePasswordFormAuthenticationListenerTest extends \PHPUnit_Framework_TestCase { @@ -48,7 +48,7 @@ class UsernamePasswordFormAuthenticationListenerTest extends \PHPUnit_Framework_ ; $listener = new UsernamePasswordFormAuthenticationListener( - $this->getMockBuilder('Symfony\Component\Security\Core\SecurityContextInterface')->getMock(), + $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')->getMock(), $authenticationManager, $this->getMockBuilder('Symfony\Component\Security\Http\Session\SessionAuthenticationStrategyInterface')->getMock(), $httpUtils, @@ -71,8 +71,8 @@ class UsernamePasswordFormAuthenticationListenerTest extends \PHPUnit_Framework_ public function getUsernameForLength() { return array( - array(str_repeat('x', SecurityContextInterface::MAX_USERNAME_LENGTH + 1), false), - array(str_repeat('x', SecurityContextInterface::MAX_USERNAME_LENGTH - 1), true), + array(str_repeat('x', Security::MAX_USERNAME_LENGTH + 1), false), + array(str_repeat('x', Security::MAX_USERNAME_LENGTH - 1), true), ); } } diff --git a/Tests/Resources/TranslationFilesTest.php b/Tests/Resources/TranslationFilesTest.php deleted file mode 100644 index 341ec87..0000000 --- a/Tests/Resources/TranslationFilesTest.php +++ /dev/null @@ -1,31 +0,0 @@ -<?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\Resources; - -class TranslationFilesTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider provideTranslationFiles - */ - public function testTranslationFileIsValid($filePath) - { - \PHPUnit_Util_XML::loadfile($filePath, false, false, true); - } - - public function provideTranslationFiles() - { - return array_map( - function ($filePath) { return (array) $filePath; }, - glob(dirname(dirname(__DIR__)).'/Resources/translations/*.xlf') - ); - } -} diff --git a/Tests/TranslationSyncStatusTest.php b/Tests/TranslationSyncStatusTest.php deleted file mode 100644 index 4b72d41..0000000 --- a/Tests/TranslationSyncStatusTest.php +++ /dev/null @@ -1,63 +0,0 @@ -<?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'; - } -} |