protected function BoxoutTest::setUp in Boxout 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ BoxoutTest.php, line 56
Class
- BoxoutTest
- Tests for Boxout.
Namespace
Drupal\Tests\boxout\FunctionalCode
protected function setUp() {
parent::setUp();
// Create admin user.
$this->adminUser = $this
->drupalCreateUser([
'administer filters',
], 'Boxout Admin', TRUE);
// Create article node type.
$this
->drupalCreateContentType([
'type' => 'article',
'name' => 'Article',
]);
// Create text format.
$filtered_html_format = FilterFormat::create([
'format' => 'boxout_filter',
'name' => 'Boxout Filter',
'weight' => 0,
'roles' => $this->adminUser
->getRoles(),
'filters' => [
'filter_html' => [
'status' => 1,
'settings' => [
'allowed_html' => '<h2> <p> <div class="boxout default plain">',
],
],
],
]);
$filtered_html_format
->save();
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('admin/config/content/formats/manage/boxout_filter');
// Set editor.
$this
->submitForm([
'editor[editor]' => 'ckeditor',
], $this
->t('editor_configure'));
// Set buttons.
$buttons = [
[
[
'name' => 'Tools',
'items' => [
'Boxout',
],
],
],
];
$this
->submitForm([
'editor[settings][toolbar][button_groups]' => json_encode($buttons),
], $this
->t('Save configuration'));
}