You are here

public function LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation in Lingotek Translation 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  2. 4.0.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  3. 3.0.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  4. 3.2.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  5. 3.3.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  6. 3.4.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  7. 3.5.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  8. 3.6.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  9. 3.7.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()
  10. 3.8.x tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php \Drupal\Tests\lingotek\Functional\LingotekConfigTranslationDocumentUploadHookTest::testBlockTranslation()

Tests that a block can be translated.

File

tests/src/Functional/LingotekConfigTranslationDocumentUploadHookTest.php, line 40

Class

LingotekConfigTranslationDocumentUploadHookTest
Tests the Lingotek config translation document upload hook.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testBlockTranslation() {

  // Place the block with title that contains a token.
  $this
    ->drupalPlaceBlock('system_powered_by_block', [
    '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 [***SITE:NAME***]');
}