You are here

public function EntityTranslationHierarchyWebTestCase::testBlockingOfTranslation in Language Hierarchy 7

Test if translation blocking mechanism is working as expected when viewing node.

File

modules/entity_translation_hierarchy/tests/entity_translation_hierarchy.test, line 147
Tests for Entity Translation Hierarchy module.

Class

EntityTranslationHierarchyWebTestCase
Functional tests for entity translation.

Code

public function testBlockingOfTranslation() {

  // Create Basic page in English.
  $node_title = $this
    ->randomName();
  $node_body = $this
    ->randomName();
  $node = $this
    ->createPageNode($node_title, $node_body, 'en');

  // Submit translation in Portuguese, Portugal.
  $node_translation_body_pt_pt = $this
    ->randomName();
  $this
    ->createTranslation($node, $node_translation_body_pt_pt, 'pt-pt');

  // Submit translation in Portuguese, International.
  $node_translation_body_pt = $this
    ->randomName();
  $this
    ->createTranslation($node, $node_translation_body_pt, 'pt');

  // Edit translation in Portuguese, Portugal.
  $edit = array(
    'translation[blocking]' => 1,
  );
  $this
    ->drupalPost('node/' . $node->nid . '/edit/pt-pt', $edit, t('Save'));
  $this
    ->drupalLogout();

  // Check if access to blocked translation is denied.
  $this
    ->get('pt-pt', 'node/' . $node->nid);
  $this
    ->assertResponse(403);
}