public function PotxTest::testDrupal7WithSyntaxError in Translation template extractor 8
Test parsing of Drupal 7 module with a syntax error.
File
- tests/
src/ Kernel/ PotxTest.php, line 204
Class
- PotxTest
- Ensure that the translation template extractor functions properly.
Namespace
Drupal\Tests\potx\KernelCode
public function testDrupal7WithSyntaxError() {
// Parse and build the Drupal 7 module file.
$filename = 'potx_test_7_with_error.module';
$file_content = "\n<?php\n\nfunction potx_test_7_with_syntax_error() {\n t('Oh god why would @you omit a parenthesis?', array('@you' => 'fool');\n t('PHP Syntax error gracefully handled');\n}\n ";
$this
->parsePhpContent($file_content, $filename, POTX_API_7);
$this
->assertMsgId('PHP Syntax error gracefully handled');
$this
->assertPotxErrors([
'Unexpected semicolon' => t('Unexpected ;'),
]);
}