CKEditorToolbarButtonTest.php in Drupal 8
File
core/modules/ckeditor/tests/src/Functional/CKEditorToolbarButtonTest.php
View source
<?php
namespace Drupal\Tests\ckeditor\Functional;
use Drupal\filter\Entity\FilterFormat;
use Drupal\editor\Entity\Editor;
use Drupal\Tests\BrowserTestBase;
use Drupal\Component\Serialization\Json;
class CKEditorToolbarButtonTest extends BrowserTestBase {
public static $modules = [
'filter',
'editor',
'ckeditor',
'locale',
];
protected $defaultTheme = 'stark';
protected function setUp() {
parent::setUp();
FilterFormat::create([
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
'filters' => [],
])
->save();
Editor::create([
'format' => 'full_html',
'editor' => 'ckeditor',
])
->save();
$this->admin_user = $this
->drupalCreateUser([
'administer languages',
'access administration pages',
'administer site configuration',
'administer filters',
]);
}
public function testImageButtonDisplay() {
$this
->drupalLogin($this->admin_user);
$edit = [];
$edit['predefined_langcode'] = 'ar';
$this
->drupalPostForm('admin/config/regional/language/add', $edit, t('Add language'));
$edit = [
'site_default_language' => 'ar',
];
$this
->drupalPostForm('admin/config/regional/language', $edit, t('Save configuration'));
$this
->drupalGet('admin/config/content/formats/manage/full_html');
$json_encode = function ($html) {
return trim(Json::encode($html), '"');
};
$markup = $json_encode(file_url_transform_relative(file_create_url('core/modules/ckeditor/js/plugins/drupalimage/icons/drupalimage.png')));
$this
->assertRaw($markup);
}
}