public function PotxTestCase::testDrupalJS in Translation template extractor 7.2
Same name and namespace in other branches
- 6.3 tests/potx.test \PotxTestCase::testDrupalJS()
- 7.3 tests/potx.test \PotxTestCase::testDrupalJS()
- 7 tests/potx.test \PotxTestCase::testDrupalJS()
Test parsing of a Drupal JS file.
File
- tests/
potx.test, line 469 - 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 testDrupalJS() {
// Parse and build the Drupal JS file (from above Drupal 5).
$filename = drupal_get_path('module', 'potx') . '/tests/potx_test.js';
$this
->parseFile($filename, POTX_API_6);
// Assert strings found in JS source code.
$this
->assertMsgID('Test string in JS');
$this
->assertPluralID('1 test string in JS', '@count test strings in JS');
$this
->assertMsgID('String with @placeholder value');
$this
->assertMsgIDContext('Test string in JS in test context', 'Test context');
$this
->assertMsgIDContext('Test string in JS in context and with @placeholder', 'Test context');
$this
->assertMsgIDContext('Multiline string for the test with @placeholder', 'Test context');
$this
->assertPluralIDContext('1 test string in JS in test context', '@count test strings in JS in test context', 'Test context');
$this
->assertPluralIDContext('1 test string in JS with context and @placeholder', '@count test strings in JS with context and @placeholder', 'Test context');
$this
->assert(count($this->potx_status) == 1, t('1 error message found'));
$this
->assert($this->potx_status[0][0] == $this->empty_error, t('Empty error found.'));
}