Add unit test for locales to ensure number of %d and %s placeholders are correct.
This commit is contained in:
parent
0826c1acdb
commit
e52a3bff90
|
|
@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue