public function PotxTest::testDrupal8CustomYml in Translation template extractor 8
Test parsing of custom yaml files.
File
- tests/
src/ Kernel/ PotxTest.php, line 458
Class
- PotxTest
- Ensure that the translation template extractor functions properly.
Namespace
Drupal\Tests\potx\KernelCode
public function testDrupal8CustomYml() {
$files = _potx_explore_dir($this->tests_root . '/potx_test_8/', '*', POTX_API_8);
_potx_init_yaml_translation_patterns();
$this
->parseFile($files[0], POTX_API_8);
$this
->assertMsgId('Test custom yaml translatable');
$this
->assertMsgIdContext('Test custom yaml translatable with context', 'Yaml translatable context');
$this
->assertPotxErrors([]);
// Test that translation patterns for a module won't be used for extracting
// translatable strings for another module.
potx_finish_processing('_potx_save_string', POTX_API_8);
$files = _potx_explore_dir($this->tests_root . '/potx_test_yml/', '*', POTX_API_8);
$this
->parseFile($this->tests_root . '/potx_test_yml/potx_test_8.test2.yml', POTX_API_8);
$this
->assertNoMsgId('Not translatable string');
$this
->assertMsgId('Translatable string');
$this
->assertMsgIdContext('Test custom yaml translatable field with context', 'Yaml translatable context');
$this
->assertPotxErrors([]);
// Test that custom translation patterns are extracted from subfolders.
$this
->parseFile($this->tests_root . '/potx_test_yml/test_folder/potx_test_8.test3.yml', POTX_API_8);
$this
->assertMsgId('Translatable string inside directory');
$this
->assertPotxErrors([]);
}