You are here

public function PotxTestCase::testDrupalJS in Translation template extractor 7

Same name and namespace in other branches
  1. 6.3 tests/potx.test \PotxTestCase::testDrupalJS()
  2. 7.3 tests/potx.test \PotxTestCase::testDrupalJS()
  3. 7.2 tests/potx.test \PotxTestCase::testDrupalJS()

Test parsing of a Drupal JS file.

File

tests/potx.test, line 197
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
    ->assertMsgID('1 test string in JS');
  $this
    ->assertPluralID('@count test strings in JS');
  $this
    ->assertMsgID('Another test string in JS');
  $this
    ->assertMsgID('Embedded test string in JS');
  $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.'));
}