outline-8.x-1.x-dev/tests/src/Functional/OutlineTranslationTest.php
tests/src/Functional/OutlineTranslationTest.php
<?php
namespace Drupal\Tests\outline\Functional;
/**
* Tests content translation for outlines.
*
* @group outline
*/
class OutlineTranslationTest extends OutlineTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['content_translation', 'language'];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
// Create an administrative user.
$this->drupalLogin($this->drupalCreateUser([
'administer outline',
'administer content translation',
]));
}
/**
* Tests language settings for outlines.
*/
public function testOutlineLanguage() {
$this->drupalGet('admin/structure/outline/add');
// Check that the field to enable content translation is available.
$this->assertField('edit-default-language-content-translation', 'The content translation checkbox is present on the page.');
// Create the outline.
$oid = mb_strtolower($this->randomMachineName());
$edit['name'] = $this->randomMachineName();
$edit['description'] = $this->randomMachineName();
$edit['langcode'] = 'en';
$edit['oid'] = $oid;
$edit['default_language[content_translation]'] = TRUE;
$this->drupalPostForm(NULL, $edit, t('Save'));
// Check if content translation is enabled on the edit page.
$this->drupalGet('admin/structure/outline/manage/' . $oid);
$this->assertFieldChecked('edit-default-language-content-translation', 'The content translation was correctly selected.');
}
}
