diff --git a/.gitignore b/.gitignore index 118ab2a..a799967 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ #dependencies -vendor/simplepie/* -vendor/JKingWeb/DrUUID/* -vendor/org/bovigo/vfs/* +vendor/simplepie +vendor/JKingWeb/DrUUID +vendor/org +vendor/Webmozart #temp files cache/* diff --git a/tests/TestLang.php b/tests/TestLang.php new file mode 100644 index 0000000..d9fb3c3 --- /dev/null +++ b/tests/TestLang.php @@ -0,0 +1,46 @@ + ' "and the Philosopher\'s Stone"];', + 'en-ca.php' => ' ' "and the Sorcerer\'s Stone"];', + 'fr.php' => ' "à l\'école des sorciers"];', + 'ja.php' => ' "賢者の石"];', + // corrupt files + 'it.php' => ' ' 'DEAD BEEF', + // empty file + 'fr-ca.php' => '', + // unreadable file + 'ru.php' => '', + ]; + + static function setUpBeforeClass() { + Lang\Exception::$test = true; + self::$vfs = vfsStream::setup("langtest", 0777, self::FILES); + self::$path = self::$vfs->url(); + // set up a file without read access + chmod(self::$path."/ru.php", 0000); + } + + static function tearDownAfterClass() { + Lang\Exception::$test = false; + self::$path = null; + self::$vfs = null; + } + + function testList() { + $this->assertEquals(sizeof(self::FILES), sizeof(Lang::list("en", "vfs://langtest/"))); + } +} \ No newline at end of file diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 4e40ffe..5292daa 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -10,6 +10,7 @@ beStrictAboutTestSize="true"> + TestLang.php TestConf.php diff --git a/vendor/JKingWeb/NewsSync/Lang.php b/vendor/JKingWeb/NewsSync/Lang.php index 7fbb5cf..7f1ae97 100644 --- a/vendor/JKingWeb/NewsSync/Lang.php +++ b/vendor/JKingWeb/NewsSync/Lang.php @@ -1,6 +1,7 @@