X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2Flanguages%2Ffr%2FLanguagesFrTest.php;h=d84feed135366f3e122785839d24f2eb9dd93e2d;hb=a5a9cf23acd1248585173aa32757d9720b5f2d62;hp=79d05172971896c67119513e739ce581f4a86737;hpb=0926d263902c184bd4f4c2036cb8ee90f81c5060;p=github%2Fshaarli%2FShaarli.git diff --git a/tests/languages/fr/LanguagesFrTest.php b/tests/languages/fr/LanguagesFrTest.php index 79d05172..d84feed1 100644 --- a/tests/languages/fr/LanguagesFrTest.php +++ b/tests/languages/fr/LanguagesFrTest.php @@ -3,7 +3,6 @@ namespace Shaarli; - use Shaarli\Config\ConfigManager; /** @@ -13,7 +12,7 @@ use Shaarli\Config\ConfigManager; * * @package Shaarli */ -class LanguagesFrTest extends \PHPUnit_Framework_TestCase +class LanguagesFrTest extends \Shaarli\TestCase { /** * @var string Config file path (without extension). @@ -28,7 +27,7 @@ class LanguagesFrTest extends \PHPUnit_Framework_TestCase /** * Init: force French */ - public function setUp() + protected function setUp(): void { $this->conf = new ConfigManager(self::$configFile); $this->conf->set('translation.language', 'fr'); @@ -37,7 +36,7 @@ class LanguagesFrTest extends \PHPUnit_Framework_TestCase /** * Reset the locale since gettext seems to mess with it, making it too long */ - public static function tearDownAfterClass() + public static function tearDownAfterClass(): void { if (! empty(getenv('UT_LOCALE'))) { setlocale(LC_ALL, getenv('UT_LOCALE')); @@ -172,4 +171,30 @@ class LanguagesFrTest extends \PHPUnit_Framework_TestCase $this->assertEquals('voiture', t($txt, $txt, 1, 'test')); $this->assertEquals('Fouille', t('Search', 'Search', 1, 'test')); } + + /** + * Test t() with an extension language file coming from the theme in gettext mode + */ + public function testTranslationThemeExtensionGettext() + { + $this->conf->set('translation.mode', 'gettext'); + $this->conf->set('raintpl_tpl', 'tests/utils/customtpl/'); + $this->conf->set('theme', 'dummy'); + new Languages('en', $this->conf); + $txt = 'rooster'; // ignore me poedit + $this->assertEquals('coq', t($txt, $txt, 1, 'dummy')); + } + + /** + * Test t() with an extension language file coming from the theme in PHP mode + */ + public function testTranslationThemeExtensionPhp() + { + $this->conf->set('translation.mode', 'php'); + $this->conf->set('raintpl_tpl', 'tests/utils/customtpl/'); + $this->conf->set('theme', 'dummy'); + new Languages('en', $this->conf); + $txt = 'rooster'; // ignore me poedit + $this->assertEquals('coq', t($txt, $txt, 1, 'dummy')); + } }