public function PotxTest::testDrupalJs in Translation template extractor 8
Test parsing of a Drupal JS file.
File
- tests/
src/ Kernel/ PotxTest.php, line 638
Class
- PotxTest
- Ensure that the translation template extractor functions properly.
Namespace
Drupal\Tests\potx\KernelCode
public function testDrupalJs() {
// Parse and build the Drupal JS file (from above Drupal 5).
$filename = $this->tests_root . '/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
->assertPotxErrors([
'Empty error' => $this->empty_error,
]);
}