Skip to content

Commit

Permalink
[Security] sync translations and add a test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Oct 6, 2015
1 parent 8d3bf03 commit 08333ec
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 6 deletions.
Expand Up @@ -8,15 +8,15 @@
</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>
<target>Bir sistem hatası nedeniyle yetkilendirme isteği işleme alınamıyor.</target>
</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>
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down
63 changes: 63 additions & 0 deletions src/Symfony/Component/Security/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';
}
}
1 change: 1 addition & 0 deletions src/Symfony/Component/Security/composer.json
Expand Up @@ -28,6 +28,7 @@
"symfony/security-http": "self.version"
},
"require-dev": {
"symfony/finder": "~2.3",
"symfony/phpunit-bridge": "~2.7",
"symfony/intl": "~2.3",
"symfony/routing": "~2.2",
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Security/phpunit.xml.dist
Expand Up @@ -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>
Expand All @@ -23,6 +24,7 @@
<directory>./</directory>
<exclude>
<directory>./vendor</directory>
<directory>./Tests</directory>
<directory>./Acl/Tests</directory>
<directory>./Core/Tests</directory>
<directory>./Http/Tests</directory>
Expand Down

0 comments on commit 08333ec

Please sign in to comment.