craue / translations-tests
Common code for testing translations in your Symfony project.
Installs: 3 417
Dependents: 5
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^7.3|^8
- phpunit/phpunit: ^8|^9
- symfony/translation: ^4.4|^5.3|^6.0|^7.0
- symfony/yaml: ^4.4|^5.3|^6.0|^7.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-11 02:29:58 UTC
README
This repository contains just some common code for testing translations in your Symfony project.
Installation
Let Composer download and install the bundle by running
composer require --dev craue/translations-tests
in a shell.
Usage
// src/app/Tests/TranslationsTest.php namespace Application\Tests; use Craue\TranslationsTests\YamlTranslationsTest; /** * @group unit */ class TranslationsTest extends YamlTranslationsTest { // only add this method to override the default implementation returning "en" protected function defineDefaultLocale() : string { return 'de'; } // specify all locations with translation files protected function defineTranslationFiles() : array { return array_merge( glob(__DIR__ . '/../../Resources/translations/*.yml'), glob(__DIR__ . '/../../Resources/*Bundle/translations/*.yml'), glob(__DIR__ . '/../../../src/*/*Bundle/Resources/translations/*.yml') ); } }