PageManagerConfigTranslationTest.php in Page Manager 8
File
src/Tests/PageManagerConfigTranslationTest.php
View source
<?php
namespace Drupal\page_manager\Tests;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\page_manager\Entity\PageVariant;
use Drupal\simpletest\WebTestBase;
class PageManagerConfigTranslationTest extends WebTestBase {
public static $modules = [
'block',
'page_manager',
'page_manager_ui',
'node',
'config_translation',
];
protected function setUp() {
parent::setUp();
ConfigurableLanguage::createFromLangcode('de')
->save();
$this
->drupalLogin($this
->drupalCreateUser([
'administer site configuration',
'translate configuration',
]));
PageVariant::create([
'variant' => 'http_status_code',
'label' => 'HTTP status code',
'id' => 'http_status_code',
'page' => 'node_view',
])
->save();
}
public function testTranslation() {
$this
->drupalGet('admin/config/regional/config-translation');
$this
->assertLinkByHref('admin/config/regional/config-translation/page');
$this
->assertLinkByHref('admin/config/regional/config-translation/page_variant');
$this
->drupalGet('admin/config/regional/config-translation/page');
$this
->assertText('Node view');
$this
->clickLink('Translate');
$this
->clickLink('Add');
$this
->assertField('translation[config_names][page_manager.page.node_view][label]');
$this
->drupalGet('admin/config/regional/config-translation/page_variant');
$this
->assertText('HTTP status code');
$this
->clickLink('Translate');
$this
->clickLink('Add');
$this
->assertField('translation[config_names][page_manager.page_variant.http_status_code][label]');
}
}