From 7a240155d9f12aa939f7e1c034cec50379f9bd83 Mon Sep 17 00:00:00 2001 From: Stefan Giehl Date: Thu, 21 Sep 2017 11:07:30 +0200 Subject: Adds test to check translation files for valid JSON (#12095) --- tests/PHPUnit/Unit/Translation/FilesTest.php | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/PHPUnit/Unit/Translation/FilesTest.php (limited to 'tests/PHPUnit') diff --git a/tests/PHPUnit/Unit/Translation/FilesTest.php b/tests/PHPUnit/Unit/Translation/FilesTest.php new file mode 100644 index 0000000000..178b230c3f --- /dev/null +++ b/tests/PHPUnit/Unit/Translation/FilesTest.php @@ -0,0 +1,38 @@ +assertNotEmpty($json, "translation file $file seems to be corrupted or empty"); + } + + public function getTranslationFiles() + { + $filesBase = glob(PIWIK_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . '*.json'); + $filesPlugins = glob(PIWIK_DOCUMENT_ROOT . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . '*.json'); + + $allFiles = array_merge($filesBase, $filesPlugins); + return array_map(function($val) { return [$val]; }, $allFiles); + } +} -- cgit v1.2.3