You are here

private function PotxTest::parsePhpContent in Translation template extractor 8

Parse the given file with the given API version.

3 calls to PotxTest::parsePhpContent()
PotxTest::testDrupal7WithSyntaxError in tests/src/Kernel/PotxTest.php
Test parsing of Drupal 7 module with a syntax error.
PotxTest::testDrupal8ConstraintMessages in tests/src/Kernel/PotxTest.php
Test parsing Drupal 8 validation constraint messages.
PotxTest::testDrupal8LanguageManager in tests/src/Kernel/PotxTest.php
Test parsing of the special DrupalManager class in Drupal 8 core.

File

tests/src/Kernel/PotxTest.php, line 680

Class

PotxTest
Ensure that the translation template extractor functions properly.

Namespace

Drupal\Tests\potx\Kernel

Code

private function parsePhpContent($code, $filename, $api_version, $string_mode = POTX_STRING_RUNTIME) {
  global $_potx_store, $_potx_strings, $_potx_install;
  $_potx_store = $_potx_strings = $_potx_install = [];
  $basename = basename($filename);
  $name_parts = pathinfo($basename);
  potx_status('set', POTX_STATUS_STRUCTURED);
  _potx_parse_php_file($code, $filename, '_potx_save_string', $name_parts, $basename, $api_version);
  _potx_build_files($string_mode, POTX_BUILD_SINGLE, 'general', '_potx_save_string', '_potx_save_version', '_potx_get_header', NULL, NULL, $api_version);

  // Grab .po representation of parsed content.
  ob_start();
  _potx_write_files('potx-test.po');
  $this->potx_output = ob_get_clean();

  // debug(var_export($this->potx_output, TRUE));.
  $this->potx_status = potx_status('get', TRUE);

  // debug(var_export($this->potx_status, TRUE));.
}