summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Evans <grknight@gentoo.org>2019-04-11 12:58:18 -0400
committerBrian Evans <grknight@gentoo.org>2019-04-11 12:58:18 -0400
commit8befe8b8f4fecc31aa7f04fbb4b31a98dce28325 (patch)
treec45b2e6a265c342333073bfef0dca899bd676721 /MLEB/UniversalLanguageSelector/tests/phpunit/ULSJsonMessageLoaderTest.php
parentUpdate Widgets for 1.32 (diff)
downloadextensions-8befe8b8f4fecc31aa7f04fbb4b31a98dce28325.tar.gz
extensions-8befe8b8f4fecc31aa7f04fbb4b31a98dce28325.tar.bz2
extensions-8befe8b8f4fecc31aa7f04fbb4b31a98dce28325.zip
Update Language Bundle to 2019.01
Signed-off-by: Brian Evans <grknight@gentoo.org>
Diffstat (limited to 'MLEB/UniversalLanguageSelector/tests/phpunit/ULSJsonMessageLoaderTest.php')
-rw-r--r--MLEB/UniversalLanguageSelector/tests/phpunit/ULSJsonMessageLoaderTest.php54
1 files changed, 54 insertions, 0 deletions
diff --git a/MLEB/UniversalLanguageSelector/tests/phpunit/ULSJsonMessageLoaderTest.php b/MLEB/UniversalLanguageSelector/tests/phpunit/ULSJsonMessageLoaderTest.php
new file mode 100644
index 00000000..817f2500
--- /dev/null
+++ b/MLEB/UniversalLanguageSelector/tests/phpunit/ULSJsonMessageLoaderTest.php
@@ -0,0 +1,54 @@
+<?php
+
+namespace UniversalLanguageSelector\Tests;
+
+use ULSJsonMessageLoader;
+
+/**
+ * @covers \ULSJsonMessageLoader
+ *
+ * @license GPL-2.0-or-later
+ * @author Thiemo Kreuz
+ */
+class ULSJsonMessageLoaderTest extends \PHPUnit\Framework\TestCase {
+ use \PHPUnit4And6Compat;
+
+ public function testGetFilenamesWithBadInput() {
+ $instance = new ULSJsonMessageLoader();
+
+ $this->setExpectedException( \MWException::class );
+ $instance->getFilenames( null );
+ }
+
+ public function testGetMessagesWithBadInput() {
+ $instance = new ULSJsonMessageLoader();
+
+ $this->setExpectedException( \MWException::class );
+ $instance->getMessages( null );
+ }
+
+ public function testWithInvalidLanguageCode() {
+ $instance = new ULSJsonMessageLoader();
+ $languageCode = '0';
+
+ $filenames = $instance->getFilenames( $languageCode );
+ $this->assertSame( [], $filenames );
+
+ $messages = $instance->getMessages( $languageCode );
+ $this->assertSame( [], $messages );
+ }
+
+ public function testWithValidLanguageCode() {
+ $instance = new ULSJsonMessageLoader();
+ $languageCode = 'en';
+
+ $filenames = $instance->getFilenames( $languageCode );
+ $this->assertContainsOnly( 'string', $filenames );
+
+ $messages = $instance->getMessages( $languageCode );
+ unset( $messages['@metadata'] );
+ $this->assertContainsOnly( 'string', array_keys( $messages ) );
+ $this->assertContainsOnly( 'string', $messages );
+ }
+
+}