class CoderReviewI18nTest in Coder 7.2
Same name and namespace in other branches
- 7 coder_review/tests/coder_review_i18n.test \CoderReviewI18NTest
Tests the Coder_review detection of internationalization functionality.
Hierarchy
- class \CoderReviewI18nTest extends \CoderReviewTestCase
Expanded class hierarchy of CoderReviewI18nTest
File
- coder_review/
tests/ coder_review_i18n.test, line 13
View source
class CoderReviewI18nTest extends CoderReviewTestCase {
/**
* Constructs a CoderReviewI18nTest instance.
*
* @param string|null $id
* (optional) An identifier for this test run. Defaults to NULL.
*/
function __construct($id = NULL) {
parent::__construct('i18n', $id);
}
public static function getInfo() {
return array(
'name' => 'Coder Review I18N Tests',
'description' => 'Tests for the coder I18N review.',
'group' => 'CoderReview',
);
}
/**
* Tests functionality to detect correct use of spaces in t() function.
*/
function testI18NSpaces() {
$this
->assertCoderReviewPass(' $var = t("Your rating");');
$this
->assertCoderReviewFail(' $var = t(" Your rating");');
$this
->assertCoderReviewFail(' $var = t("Your rating ");');
$this
->assertCoderReviewPass(' $var = t("Your rating") ."hello ";');
$this
->assertCoderReviewPass(' $var = t("Your rating") ." hello";');
$this
->assertCoderReviewPass(" \$var = t('Your rating');");
$this
->assertCoderReviewFail(" \$var = t(' Your rating');");
$this
->assertCoderReviewFail(" \$var = t('Your rating ');");
$this
->assertCoderReviewPass(" \$var = t('Your rating') .'hello ';");
$this
->assertCoderReviewPass(" \$var = t('Your rating') .' hello';");
$this
->assertCoderReviewPass(" 'titleUser' => t('Your rating') .': ',");
$this
->assertCoderReviewFail(" \$var = t('This isn't a false positive ');");
$this
->assertCoderReviewFail(" \$var = t('This isn\\'t a \"false\" positive ');");
$this
->assertCoderReviewPass(" \$var = t('This is a false positive') . implode(', ', \$array);");
$this
->assertCoderReviewPass(" \$var = t('This is a \\'false\\\" positive');");
$this
->assertCoderReviewPass(" \$var = t('This is a \"false\" positive');");
$this
->assertCoderReviewPass(" \$var = t('Your rating') . t('pass');");
$this
->assertCoderReviewFail(" \$var = t('Your rating') . t(' fail');");
$this
->assertCoderReviewFail(" \$var = t('Your rating') . t('fail ');");
$this
->assertCoderReviewFail(" \$var = t('Your rating') . t(' fail ');");
$this
->assertCoderReviewFail(" \$var = t(' Your rating ') . t(' fail ');");
$this
->assertCoderReviewFail(" \$var = t(' Your rating') . t('fail');");
$this
->assertCoderReviewFail(" \$var = t('Your rating ') . t('fail');");
$this
->assertCoderReviewFail(" \$var = t(' Your rating ') . t('fail');");
$this
->assertCoderReviewFail(" \$var = t('Your rating ') . t('fail ');");
$this
->assertCoderReviewFail(" \$var = t(' Your rating ') . t('fail ');");
$this
->assertCoderReviewFail(" \$var = t('Your rating ') . t(' fail');");
$this
->assertCoderReviewFail(" \$description[] = t('until !until ', array('!until' => date_format_date(\$until, 'custom', \$format)));");
$this
->assertCoderReviewFail(" \$description[] = t('except !dates ', array('!dates' => implode(', ', \$values)));");
}
/**
* Tests functionality to detect multiple incorrect use of t() function.
*/
function testExtraTs() {
$this
->assertCoderReviewPass(" watchdog('name', 'Your message.');");
$this
->assertCoderReviewFail(" watchdog('name', t('Your message.'));");
$this
->assertCoderReviewFail(" watchdog('name', st('Your message.'));");
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CoderReviewI18nTest:: |
public static | function | ||
CoderReviewI18nTest:: |
function | Tests functionality to detect multiple incorrect use of t() function. | ||
CoderReviewI18nTest:: |
function | Tests functionality to detect correct use of spaces in t() function. | ||
CoderReviewI18nTest:: |
function | Constructs a CoderReviewI18nTest instance. |