craue / translations-tests
Common code for testing translations in your Symfony project.
2.0.0
2026-09-16 07:56 UTC
Requires
- php: ^8.2
- phpunit/phpunit: ^11.5.50 || ^12.5.8 || ^13.3
- symfony/translation: ^5.4 || ^6.4 || ^7.4 || ^8.1
- symfony/yaml: ^5.4 || ^6.4 || ^7.4 || ^8.1
Requires (Dev)
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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') ); } }