]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - tests/Wallabag/CoreBundle/Entity/EntryTest.php
Use lang attribute
[github/wallabag/wallabag.git] / tests / Wallabag / CoreBundle / Entity / EntryTest.php
diff --git a/tests/Wallabag/CoreBundle/Entity/EntryTest.php b/tests/Wallabag/CoreBundle/Entity/EntryTest.php
new file mode 100644 (file)
index 0000000..d400636
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+
+namespace Tests\Wallabag\CoreBundle\Entity;
+
+use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
+use Wallabag\CoreBundle\Entity\Entry;
+
+class EntryTest extends WallabagCoreTestCase
+{
+    public function testGetLanguage()
+    {
+        $this->logInAs('admin');
+        $entry = new Entry($this->getLoggedInUser());
+        $languages = [
+            'en_GB' => 'en-GB',
+            'en_US' => 'en-US',
+            'en-gb' => 'en-GB',
+            'en-US' => 'en-US',
+            'fr' => 'fr',
+            'fr_FR' => 'fr-FR',
+            'ja' => 'ja',
+        ];
+        foreach ($languages as $entryLang => $lang) {
+            $entry->setLanguage($entryLang);
+            $this->assertSame($lang, $entry->getHTMLLanguage());
+        }
+    }
+}