coder_i18n.test in Coder 6
File
tests/coder_i18n.test
View source
<?php
require_once dirname(__FILE__) . '/coder_test_case.tinc';
class CoderI18NTest extends CoderTestCase {
function __construct($id = NULL) {
parent::__construct('i18n', $id);
}
function getInfo() {
return array(
'name' => t('Coder I18N Tests'),
'description' => t('Tests for the coder I18N review.'),
'group' => t('Coder'),
);
}
function testI18NSpaces() {
$this
->assertCoderPass(' $var = t("Your rating");');
$this
->assertCoderFail(' $var = t(" Your rating");');
$this
->assertCoderFail(' $var = t("Your rating ");');
$this
->assertCoderPass(' $var = t("Your rating") ."hello ";');
$this
->assertCoderPass(' $var = t("Your rating") ." hello";');
$this
->assertCoderPass(" \$var = t('Your rating');");
$this
->assertCoderFail(" \$var = t(' Your rating');");
$this
->assertCoderFail(" \$var = t('Your rating ');");
$this
->assertCoderPass(" \$var = t('Your rating') .'hello ';");
$this
->assertCoderPass(" \$var = t('Your rating') .' hello';");
$this
->assertCoderPass(" 'titleUser' => t('Your rating') .': ',");
$this
->assertCoderFail(" \$var = t('This isn't a false positive ');");
$this
->assertCoderFail(" \$var = t('This isn\\'t a \"false\" positive ');");
$this
->assertCoderPass(" \$var = t('This is a false positive') . implode(', ', \$array);");
$this
->assertCoderPass(" \$var = t('This is a \\'false\\\" positive');");
$this
->assertCoderPass(" \$var = t('This is a \"false\" positive');");
$this
->assertCoderPass(" \$var = t('Your rating') . t('pass');");
$this
->assertCoderFail(" \$var = t('Your rating') . t(' fail');");
$this
->assertCoderFail(" \$var = t('Your rating') . t('fail ');");
$this
->assertCoderFail(" \$var = t('Your rating') . t(' fail ');");
$this
->assertCoderFail(" \$var = t(' Your rating ') . t(' fail ');");
$this
->assertCoderFail(" \$var = t(' Your rating') . t('fail');");
$this
->assertCoderFail(" \$var = t('Your rating ') . t('fail');");
$this
->assertCoderFail(" \$var = t(' Your rating ') . t('fail');");
$this
->assertCoderFail(" \$var = t('Your rating ') . t('fail ');");
$this
->assertCoderFail(" \$var = t(' Your rating ') . t('fail ');");
$this
->assertCoderFail(" \$var = t('Your rating ') . t(' fail');");
$this
->assertCoderFail(" \$description[] = t('until !until ', array('!until' => date_format_date(\$until, 'custom', \$format)));");
$this
->assertCoderFail(" \$description[] = t('except !dates ', array('!dates' => implode(', ', \$values)));");
}
}