public function PotxTest::testDrupal6 in Translation template extractor 8
Test parsing of Drupal 6 module.
File
- tests/
src/ Kernel/ PotxTest.php, line 94
Class
- PotxTest
- Ensure that the translation template extractor functions properly.
Namespace
Drupal\Tests\potx\KernelCode
public function testDrupal6() {
// Parse and build the Drupal 6 module file.
$filename = $this->tests_root . '/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
->assertPotxErrors([
'First empty error' => $this->empty_error,
'Second empty error' => $this->empty_error,
'Third empty error' => $this->empty_error,
]);
}