Add unit test for locales to ensure number of %d and %s placeholders are correct.

This commit is contained in:
Colin Williams 2015-06-19 17:59:39 +01:00
parent 0826c1acdb
commit e52a3bff90
1 changed files with 29 additions and 0 deletions

View File

@ -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
);
}
}
}
}
}