You are here

public function PageManagerTranslationIntegrationTest::testNode in Page Manager 8.4

Tests that overriding the node page does not prevent translation.

File

tests/src/Functional/PageManagerTranslationIntegrationTest.php, line 55

Class

PageManagerTranslationIntegrationTest
Tests that overriding the entity page does not affect content translation.

Namespace

Drupal\Tests\page_manager\Functional

Code

public function testNode() {
  $this
    ->drupalPlaceBlock('local_tasks_block');
  $this
    ->drupalPlaceBlock('page_title_block');
  $node = $this
    ->drupalCreateNode([
    'type' => 'article',
  ]);
  $this
    ->drupalGet('node/' . $node
    ->id());
  $this
    ->assertResponse(200);
  $this
    ->assertText($node
    ->label());
  $this
    ->clickLink('Translate');
  $this
    ->assertResponse(200);

  // Create a new variant.
  $http_status_variant = PageVariant::create([
    'variant' => 'http_status_code',
    'label' => 'HTTP status code',
    'id' => 'http_status_code',
    'page' => 'node_view',
  ]);
  $http_status_variant
    ->getVariantPlugin()
    ->setConfiguration([
    'status_code' => 200,
  ]);
  $http_status_variant
    ->save();
  $this
    ->triggerRouterRebuild();
  $this
    ->drupalGet('node/' . $node
    ->id());
  $this
    ->assertResponse(200);
  $this
    ->clickLink('Translate');
  $this
    ->assertResponse(200);
}