craue / translations-tests
为您的 Symfony 项目测试翻译的通用代码。
1.2.1
2024-01-11 00:37 UTC
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-09-11 02:17:09 UTC
README
此仓库仅包含用于在您的 Symfony 项目中测试翻译的一些通用代码。
安装
在壳中运行以下命令,让 Composer 下载并安装此包:
composer require --dev craue/translations-tests
。
用法
// 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') ); } }