public function Update360Test::test in Lightning Media 8.4
Same name and namespace in other branches
- 8.3 tests/src/Functional/Update360Test.php \Drupal\Tests\lightning_media\Functional\Update360Test::test()
Tests creating a CKEditor-specific media browser from the iFrame one.
File
- tests/
src/ Functional/ Update360Test.php, line 54
Class
- Update360Test
- Tests the optional configuration updates targeting Lightning Media 3.6.0.
Namespace
Drupal\Tests\lightning_media\FunctionalCode
public function test() {
$io = $this
->prophesize(StyleInterface::class);
$io
->confirm(Argument::type('string'))
->shouldBeCalledOnce()
->willReturn(TRUE);
$io
->ask(Argument::type('string'), Argument::any())
->shouldBeCalledTimes(2)
->willReturnArgument(1);
// For reasons unclear, using $this->container to get the class resolver
// will only work if $this->resetAll() is called when installing Lightning
// Roles in setUp(). So, basically, a functional test can either use
// $this->container or \Drupal, but not both.
\Drupal::classResolver(Update360::class)
->cloneMediaBrowser($io
->reveal());
/** @var \Drupal\entity_browser\EntityBrowserInterface $browser */
$browser = EntityBrowser::load('ckeditor_media_browser');
$this
->assertInstanceOf(EntityBrowser::class, $browser);
$this
->assertSame('Media browser (CKEditor)', $browser
->label());
$this
->assertSame('iframe', $browser
->getDisplay()
->getPluginId());
$settings = EmbedButton::load('media_browser')
->getTypeSettings();
$this
->assertSame('ckeditor_media_browser', $settings['entity_browser']);
/** @var \Drupal\entity_browser\DisplayInterface $browser_display */
$browser_display = EntityBrowser::load('media_browser')
->getDisplay();
$this
->assertSame('modal', $browser_display
->getPluginId());
$settings = $browser_display
->getConfiguration();
$this
->assertEmpty($settings['width']);
$this
->assertEmpty($settings['height']);
$this
->assertSame('Add media', $settings['link_text']);
$this
->assertFalse($settings['auto_open']);
$this
->assertPermissions('media_creator');
$this
->assertPermissions('media_manager');
$this
->assertPermissions('test_creator');
}