public function SmartlingTranslatorTest::testAddSmartlingDirectives in TMGMT Translator Smartling 8.4
Same name and namespace in other branches
- 8.3 tests/src/Kernel/SmartlingTranslatorTest.php \Drupal\Tests\tmgmt_smartling\Kernel\SmartlingTranslatorTest::testAddSmartlingDirectives()
Test adding directives to upload params.
File
- tests/src/ Kernel/ SmartlingTranslatorTest.php, line 98 
Class
- SmartlingTranslatorTest
- Tests for smartling translator.
Namespace
Drupal\Tests\tmgmt_smartling\KernelCode
public function testAddSmartlingDirectives() {
  $this->moduleHandler
    ->expects($this
    ->once())
    ->method('alter');
  $job = $this
    ->createJobWithItems([]);
  $actual = $this->smartlingTranslator
    ->addSmartlingDirectives(new UploadFileParameters(), $job)
    ->exportToArray();
  $this
    ->assertEquals($actual['authorize'], FALSE);
  $this
    ->assertTrue((bool) preg_match('/^{"client":"smartling-api-sdk-php","version":"\\d+\\.\\d+\\.\\d+"}$/', $actual['smartling.client_lib_id']));
  $this
    ->assertEquals($actual['smartling.translate_paths'], 'html/body/div/div, html/body/div/span');
  $this
    ->assertEquals($actual['smartling.string_format_paths'], 'html : html/body/div/div, @default : html/body/div/span');
  $this
    ->assertEquals($actual['smartling.variants_enabled'], 'true');
  $this
    ->assertEquals($actual['smartling.source_key_paths'], 'html/body/div/{div.sl-variant}, html/body/div/{span.sl-variant}');
  $this
    ->assertEquals($actual['smartling.character_limit_paths'], 'html/body/div/limit');
  $this
    ->assertEquals($actual['smartling.placeholder_format_custom'], '(@|%|!)[\\w-]+');
}