diff options
author | Colin Williams <github@crwilliams.co.uk> | 2015-06-19 17:59:39 +0100 |
---|---|---|
committer | Colin Williams <github@crwilliams.co.uk> | 2015-06-19 17:59:39 +0100 |
commit | e52a3bff90c8f81cb1981e5ba587a2500b5b9596 (patch) | |
tree | 97a018fa56950237f4e5c3aa0292342c276ff94f /tests | |
parent | 0826c1acdb6ae900d9ad3d277b13744a744ea34f (diff) |
Add unit test for locales to ensure number of %d and %s placeholders are correct.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/units/LocaleTest.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/units/LocaleTest.php b/tests/units/LocaleTest.php new file mode 100644 index 00000000..7f8dd7c9 --- /dev/null +++ b/tests/units/LocaleTest.php @@ -0,0 +1,29 @@ +<?php + +require_once __DIR__.'/Base.php'; + +class LocaleTest extends Base +{ + public function testLocales() + { + foreach(glob('app/Locale/*') as $l) + { + $locale = require($l . '/translations.php'); + foreach($locale as $k => $v) + { + if(strpos($k,'%B %e, %Y') !== false) + continue; + if(strpos($k,'%b %e, %Y') !== false) + continue; + foreach(array('%s', '%d') as $placeholder) + { + $this->assertEquals( + substr_count($k, '%s'), + substr_count($v, '%s'), + 'Incorrect number of ' . $placeholder . ' in ' . basename($l) .' translation of: ' . $k + ); + } + } + } + } +} |