]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(rtl): Add unittest for language direction
authorMostafa Ahangarha <ahangarha@riseup.net>
Sun, 17 Dec 2023 21:10:12 +0000 (00:40 +0330)
committerJoas Schilling <coding@schilljs.com>
Mon, 23 Sep 2024 14:59:21 +0000 (16:59 +0200)
Signed-off-by: Mostafa Ahangarha <ahangarha@riseup.net>
tests/lib/L10N/FactoryTest.php

index 0f243c124ca41c13609fe1850e7fa0d781246b21..510c165eba9a4c86908749301434655e1f1e99e2 100644 (file)
@@ -775,4 +775,22 @@ class FactoryTest extends TestCase {
                $iterator = $factory->getLanguageIterator($iUserMock);
                self::assertInstanceOf(ILanguageIterator::class, $iterator);
        }
+
+       public static function languagesWithRespectedDirection():array {
+               return [
+                       ['en', 'ltr'],
+                       ['de', 'ltr'],
+                       ['fa', 'rtl'],
+                       ['ar', 'rtl']
+               ];
+       }
+
+       /**
+        * @dataProvider languagesWithRespectedDirection
+        */
+       public function testDirectionOfLocales(string $locale, string $expectedDirection) {
+               $factory = $this->getFactory();
+
+               self::assertEquals($expectedDirection, $factory->getLanguageDirectionFromLocale($locale));
+       }
 }