diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2019-10-30 04:54:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-30 04:54:38 +0100 |
commit | 4c81fee548a25acfa543b8fc95d9505204f9974b (patch) | |
tree | 5d1082d1d69e27ccad08243968ef2a6c7b7a6399 /tests/Unit/Helpers | |
parent | d00d66a634498038de6d3536f434749070104b93 (diff) | |
parent | 8a298f0f5eedcf6520af58bdd3d5087b1fc39272 (diff) |
Merge pull request #667 from lujoga/translation
Fix some translation-related issues
Diffstat (limited to 'tests/Unit/Helpers')
-rw-r--r-- | tests/Unit/Helpers/Translation/Assets/ba_RR/additional.po | 3 | ||||
-rw-r--r-- | tests/Unit/Helpers/Translation/Assets/fo_OO/additional.mo | bin | 0 -> 93 bytes | |||
-rw-r--r-- | tests/Unit/Helpers/Translation/Assets/fo_OO/additional.po | 3 | ||||
-rw-r--r-- | tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php | 7 |
4 files changed, 11 insertions, 2 deletions
diff --git a/tests/Unit/Helpers/Translation/Assets/ba_RR/additional.po b/tests/Unit/Helpers/Translation/Assets/ba_RR/additional.po new file mode 100644 index 00000000..72383947 --- /dev/null +++ b/tests/Unit/Helpers/Translation/Assets/ba_RR/additional.po @@ -0,0 +1,3 @@ +# Testing content +msgid "validation.foo.bar" +msgstr "B Arr required!" diff --git a/tests/Unit/Helpers/Translation/Assets/fo_OO/additional.mo b/tests/Unit/Helpers/Translation/Assets/fo_OO/additional.mo Binary files differnew file mode 100644 index 00000000..73faf3ba --- /dev/null +++ b/tests/Unit/Helpers/Translation/Assets/fo_OO/additional.mo diff --git a/tests/Unit/Helpers/Translation/Assets/fo_OO/additional.po b/tests/Unit/Helpers/Translation/Assets/fo_OO/additional.po new file mode 100644 index 00000000..8eea7df9 --- /dev/null +++ b/tests/Unit/Helpers/Translation/Assets/fo_OO/additional.po @@ -0,0 +1,3 @@ +# Testing content +msgid "validation.foo.bar" +msgstr "Foo Bar required!" diff --git a/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php b/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php index e55fdf02..8c9e21b8 100644 --- a/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php +++ b/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php @@ -7,6 +7,7 @@ use Engelsystem\Helpers\Translation\TranslationServiceProvider; use Engelsystem\Helpers\Translation\Translator; use Engelsystem\Test\Unit\ServiceProviderTest; use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\MockObject\Rule\InvokedCount; use Symfony\Component\HttpFoundation\Session\Session; class TranslationServiceProviderTest extends ServiceProviderTest @@ -82,11 +83,12 @@ class TranslationServiceProviderTest extends ServiceProviderTest $app = $this->getApp(['get']); $serviceProvider = new TranslationServiceProvider($app); - $this->setExpects($app, 'get', ['path.lang'], __DIR__ . '/Assets'); + $this->setExpects($app, 'get', ['path.lang'], __DIR__ . '/Assets', new InvokedCount(2)); // Get translator $translator = $serviceProvider->getTranslator('fo_OO'); $this->assertEquals('Foo Bar!', $translator->gettext('foo.bar')); + $this->assertEquals('Foo Bar required!', $translator->gettext('validation.foo.bar')); // Retry from cache $serviceProvider->getTranslator('fo_OO'); @@ -99,12 +101,13 @@ class TranslationServiceProviderTest extends ServiceProviderTest public function testGetTranslatorFromPo(): void { $app = $this->getApp(['get']); - $this->setExpects($app, 'get', ['path.lang'], __DIR__ . '/Assets'); + $this->setExpects($app, 'get', ['path.lang'], __DIR__ . '/Assets', new InvokedCount(2)); $serviceProvider = new TranslationServiceProvider($app); // Get translator using a .po file $translator = $serviceProvider->getTranslator('ba_RR'); $this->assertEquals('B Arr!', $translator->gettext('foo.bar')); + $this->assertEquals('B Arr required!', $translator->gettext('validation.foo.bar')); } } |