function CKEditorIntegrationTest::setUp
Same name in this branch
- 8.9.x core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::setUp()
- 8.9.x core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest::setUp()
Same name in other branches
- 9 core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ media_library/ tests/ src/ FunctionalJavascript/ CKEditorIntegrationTest.php, line 59
Class
- CKEditorIntegrationTest
- @coversDefaultClass \Drupal\media_library\Plugin\CKEditorPlugin\DrupalMediaLibrary @group media_library
Namespace
Drupal\Tests\media_library\FunctionalJavascriptCode
protected function setUp() {
parent::setUp();
FilterFormat::create([
'format' => 'test_format',
'name' => 'Test format',
'filters' => [
'media_embed' => [
'status' => TRUE,
],
],
])->save();
Editor::create([
'editor' => 'ckeditor',
'format' => 'test_format',
'settings' => [
'toolbar' => [
'rows' => [
[
[
'name' => 'Main',
'items' => [
'Source',
'Undo',
'Redo',
],
],
],
[
[
'name' => 'Embeds',
'items' => [
'DrupalMediaLibrary',
],
],
],
],
],
],
])->save();
$this->drupalCreateContentType([
'type' => 'blog',
]);
// Note that media_install() grants 'view media' to all users by default.
$this->user = $this->drupalCreateUser([
'use text format test_format',
'access media overview',
'create blog content',
]);
// Create a media type that starts with the letter a, to test tab order.
$this->createMediaType('image', [
'id' => 'arrakis',
'label' => 'Arrakis',
]);
// Create a sample media entity to be embedded.
$this->createMediaType('image', [
'id' => 'image',
'label' => 'Image',
]);
File::create([
'uri' => $this->getTestFiles('image')[0]->uri,
])
->save();
$this->media = Media::create([
'bundle' => 'image',
'name' => 'Fear is the mind-killer',
'field_media_image' => [
[
'target_id' => 1,
'alt' => 'default alt',
'title' => 'default title',
],
],
]);
$this->media
->save();
$arrakis_media = Media::create([
'bundle' => 'arrakis',
'name' => 'Le baron Vladimir Harkonnen',
'field_media_image' => [
[
'target_id' => 1,
'alt' => 'Il complote pour détruire le duc Leto',
'title' => 'Il complote pour détruire le duc Leto',
],
],
]);
$arrakis_media->save();
$this->drupalLogin($this->user);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.