PageManagerTranslationIntegrationTest.php in Page Manager 8.4
File
tests/src/Functional/PageManagerTranslationIntegrationTest.php
View source
<?php
namespace Drupal\Tests\page_manager\Functional;
use Drupal\page_manager\Entity\PageVariant;
use Drupal\Tests\content_translation\Functional\ContentTranslationTestBase;
class PageManagerTranslationIntegrationTest extends ContentTranslationTestBase {
use PageTestHelperTrait;
protected $defaultTheme = 'stark';
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);
}
}