Add unit test for locales to ensure number of %d and %s placeholders are correct.
This commit is contained in:
29
tests/units/LocaleTest.php
Normal file
29
tests/units/LocaleTest.php
Normal 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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user