]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - tests/LanguagesTest.php
Load theme translations files automatically
[github/shaarli/Shaarli.git] / tests / LanguagesTest.php
index 864ce63060de1b9fb0c98f4599d5e40fe5064170..4951e09a3e2f31261ca9b119d700fb817a3e860f 100644 (file)
@@ -175,6 +175,32 @@ class LanguagesTest extends \PHPUnit_Framework_TestCase
         $this->assertEquals($text, t($text));
     }
 
+    /**
+     * 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('rooster', 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('rooster', t($txt, $txt, 1, 'dummy'));
+    }
+
     /**
      * Test t() with an extension language file in gettext mode
      */