public function PotxTestCase::testDrupal6 in Translation template extractor 7.2
Same name and namespace in other branches
- 6.3 tests/potx.test \PotxTestCase::testDrupal6()
- 7.3 tests/potx.test \PotxTestCase::testDrupal6()
- 7 tests/potx.test \PotxTestCase::testDrupal6()
Test parsing of Drupal 6 module.
File
- tests/
potx.test, line 83 - Tests to ensure that the template extractor works as intended.
Class
- PotxTestCase
- @file Tests to ensure that the template extractor works as intended.
Code
public function testDrupal6() {
// Parse and build the Drupal 6 module file.
$filename = drupal_get_path('module', 'potx') . '/tests/potx_test_6.module';
$this
->parseFile($filename, POTX_API_6);
// Assert strings found in module source code.
$this
->assertMsgID('Test menu item');
$this
->assertMsgID('This is a test menu item');
$this
->assertMsgID('This is a test string.');
$this
->assertMsgID('test watchdog type');
$this
->assertMsgID('My watchdog message');
$this
->assertMsgID('test potx permission');
$this
->assertMsgID('one more test potx permission');
$this
->assertPluralID('1 test string', '@count test strings');
$this
->assertMsgID('Test menu item description');
$this
->assertMsgID('Test menu item description altered (1)');
$this
->assertMsgID('Test menu item description altered (2)');
$this
->assertMsgID('Test menu item title altered');
// Installer string should not appear in runtime output.
$this
->assertNoMsgID('Installer only test string');
$this
->assertMsgID('Dynamic callback test string');
$this
->assertNoMsgID('Installer string in context');
// No context support yet.
$this
->assertNoMsgIDContext('Test string in context', 'Test context');
$this
->assertMsgID('Test string in context');
$this
->assertNoMsgIDContext('Dynamic string in context', 'Dynamic context');
$this
->assertMsgID('Dynamic string in context');
$this
->assertPluralID('1 test string in context', '@count test strings in context');
$this
->assertNoPluralIDContext('1 test string in context', '@count test strings in context', 'Test context');
// Look at installer strings.
$this
->parseFile($filename, POTX_API_6, POTX_STRING_INSTALLER);
$this
->assertMsgID('Installer only test string');
$this
->assertMsgID('Dynamic callback test string');
$this
->assertNoMsgID('1 test string');
$this
->assertNoMsgID('This is a test string.');
$this
->assertNoMsgIDContext('Installer string in context', 'Installer context');
$this
->assertMsgID('Installer string in context');
$this
->assertNoMsgIDContext('Dynamic string in context', 'Dynamic context');
$this
->assertMsgID('Dynamic string in context');
$this
->assert(count($this->potx_status) == 3, t('3 error messages found'));
$this
->assert($this->potx_status[0][0] == $this->empty_error, t('First empty error found.'));
$this
->assert($this->potx_status[1][0] == $this->empty_error, t('Second empty error found.'));
$this
->assert($this->potx_status[2][0] == $this->empty_error, t('Third empty error found.'));
}