function MediaLibraryTest::setUp
Same name in this branch
- 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaLibraryTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaLibraryTest::setUp()
Same name in other branches
- 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaLibraryTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaLibraryTest::setUp()
- 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaLibraryTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaLibraryTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ MediaLibraryTest.php, line 60
Class
- MediaLibraryTest
- @coversDefaultClass \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalMediaLibrary @group ckeditor @group legacy
Namespace
Drupal\Tests\ckeditor\FunctionalJavascriptCode
protected function setUp() : void {
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.