You are here

public function LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation in Lingotek Translation 8

Tests that a block can be translated.

File

src/Tests/LingotekConfigTranslationDocumentUploadHookTest.php, line 39

Class

LingotekConfigTranslationDocumentUploadHookTest
Tests the Lingotek config translation document upload hook.

Namespace

Drupal\lingotek\Tests

Code

public function testBlockTranslation() {

  // Place the block with title that contains a token.
  $this
    ->drupalPlaceBlock('system_powered_by_block', array(
    'label' => t('Title with [site:name]'),
  ));

  // Check that [token] is encoded via hook_lingotek_config_entity_document_upload().
  // @see lingotek_test_lingotek_config_entity_document_upload()
  $data = json_decode(\Drupal::state()
    ->get('lingotek.uploaded_content', '[]'), true);
  $this
    ->assertEqual($data['settings.label'], 'Title with [***c2l0ZTpuYW1l***]');
}