protected function MediaTest::setUp in Drupal 10
Same name in this branch
- 10 core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\MediaTest::setUp()
- 10 core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\MediaTest::setUp()
File
- core/
modules/ ckeditor/ tests/ src/ FunctionalJavascript/ MediaTest.php, line 87
Class
- MediaTest
- @coversDefaultClass \Drupal\ckeditor\Plugin\CKEditorPlugin\DrupalMedia @group ckeditor
Namespace
Drupal\Tests\ckeditor\FunctionalJavascriptCode
protected function setUp() : void {
parent::setUp();
FilterFormat::create([
'format' => 'test_format',
'name' => 'Test format',
'filters' => [
'filter_align' => [
'status' => TRUE,
],
'filter_caption' => [
'status' => TRUE,
],
'media_embed' => [
'status' => TRUE,
],
],
])
->save();
Editor::create([
'editor' => 'ckeditor',
'format' => 'test_format',
'settings' => [
'toolbar' => [
'rows' => [
[
[
'name' => 'All the things',
'items' => [
'Source',
'Bold',
'Italic',
'DrupalLink',
'DrupalUnlink',
'DrupalImage',
],
],
],
],
],
],
])
->save();
// Note that media_install() grants 'view media' to all users by default.
$this->adminUser = $this
->drupalCreateUser([
'use text format test_format',
'bypass node access',
]);
// Create a sample media entity to be embedded.
$this
->createMediaType('image', [
'id' => 'image',
]);
File::create([
'uri' => $this
->getTestFiles('image')[0]->uri,
])
->save();
$this->media = Media::create([
'bundle' => 'image',
'name' => 'Screaming hairy armadillo',
'field_media_image' => [
[
'target_id' => 1,
'alt' => 'default alt',
'title' => 'default title',
],
],
]);
$this->media
->save();
// Create a sample host entity to embed media in.
$this
->drupalCreateContentType([
'type' => 'blog',
]);
$this->host = $this
->createNode([
'type' => 'blog',
'title' => 'Animals with strange names',
'body' => [
'value' => '<drupal-media data-caption="baz" data-entity-type="media" data-entity-uuid="' . $this->media
->uuid() . '"></drupal-media>',
'format' => 'test_format',
],
]);
$this->host
->save();
$this
->drupalLogin($this->adminUser);
}