PageManagerTranslationIntegrationTest.php in Page Manager 8
File
src/Tests/PageManagerTranslationIntegrationTest.php
View source
<?php
namespace Drupal\page_manager\Tests;
use Drupal\content_translation\Tests\ContentTranslationTestBase;
use Drupal\page_manager\Entity\PageVariant;
class PageManagerTranslationIntegrationTest extends ContentTranslationTestBase {
use PageTestHelperTrait;
public static $modules = [
'block',
'page_manager',
'node',
'content_translation',
];
protected $entityTypeId = 'node';
protected $bundle = 'article';
protected function setupBundle() {
parent::setupBundle();
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
}
protected function getTranslatorPermissions() {
return array_merge(parent::getTranslatorPermissions(), [
'administer pages',
'administer pages',
]);
}
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);
$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);
}
}