.../media/tests/src/Functional/FilterTest.php | 141 --------------------- 1 file changed, 141 deletions(-) diff --git a/core/modules/media/tests/src/Functional/FilterTest.php b/core/modules/media/tests/src/Functional/FilterTest.php deleted file mode 100644 index 2579d40372..0000000000 --- a/core/modules/media/tests/src/Functional/FilterTest.php +++ /dev/null @@ -1,141 +0,0 @@ -drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']); - FilterFormat::create([ - 'format' => 'custom_format', - 'name' => 'Custom format', - 'filters' => [ - 'media_embed' => [ - 'status' => 1, - ], - ], - ])->save(); - - // Create a user with required permissions. - $this->webUser = $this->drupalCreateUser([ - 'access content', - 'view media', - 'create page content', - 'use text format custom_format', - 'access in-place editing', - 'access contextual links', - ]); - $this->drupalLogin($this->webUser); - - file_put_contents('public://llama.jpg', str_repeat('t', 10)); - $file = File::create([ - 'uri' => 'public://llama.jpg', - 'filename' => 'llama.jpg', - ]); - $file->save(); - - $media_type = $this->createMediaType('image'); - - EntityViewMode::create([ - 'id' => 'media.foobar', - 'targetEntityType' => 'media', - 'status' => TRUE, - 'enabled' => TRUE, - 'label' => $this->randomMachineName(), - ])->save(); - - EntityViewDisplay::create([ - 'targetEntityType' => 'media', - 'bundle' => $media_type->id(), - 'mode' => 'foobar', - 'status' => TRUE, - ])->removeComponent('thumbnail') - ->removeComponent('created') - ->removeComponent('uid') - ->setComponent('field_media_image', [ - 'label' => 'visually_hidden', - 'type' => 'image', - 'settings' => [ - 'image_style' => 'medium', - 'image_link' => 'file', - ], - 'third_party_settings' => [], - 'weight' => 1, - 'region' => 'content', - ]) - ->save(); - - $this->media = Media::create([ - 'bundle' => $media_type->id(), - 'field_media_image' => [ - 0 => [ - 'target_id' => $file->Id(), - 'alt' => 'So hipster.', - ], - ], - ]); - $this->media->save(); - } - - /** - * Tests the media_embed filter. - * - * Ensures that entities are getting rendered when correct data attributes - * are passed. Also tests situations when embed fails. - */ - public function testFilter() { - $content = 'This placeholder should not be rendered.'; - $settings = []; - $settings['type'] = 'page'; - $settings['title'] = 'Test entity embed with entity-id and view-mode'; - $settings['body'] = [['value' => $content, 'format' => 'custom_format']]; - $node = $this->drupalCreateNode($settings); - $this->drupalGet('node/' . $node->id()); - // Embedded media rendered. - $this->assertSession()->responseNotContains('assertSession()->responseContains('llama.jpg'); - $this->assertSession()->responseContains('files/styles/medium/public/llama.jpg'); - - // @todo Improve \Drupal\Tests\entity_embed\Functional\EntityEmbedFilterTest so that we don't need to change as much here. Also, specifically add test coverage for: - // - missing view mode - // - existing view mode but missing corresponding view display - // - embedded media is not render cached - } - -}