public function MediaBrowserEmbedCodeWidgetTest::testInvalidInput in Lightning Media 8.3
Overrides MediaBrowserWidgetTestBase::testInvalidInput
File
- tests/
src/ Functional/ MediaBrowserEmbedCodeWidgetTest.php, line 41
Class
- MediaBrowserEmbedCodeWidgetTest
- @group lightning_media
Namespace
Drupal\Tests\lightning_media\FunctionalCode
public function testInvalidInput() {
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
parent::testInvalidInput();
$assert_session
->pageTextContains('You must enter a URL or embed code.');
// The widget should raise an error if the input cannot match any media
// type.
$page
->fillField('input', 'The quick brown fox gets eaten by hungry lions.');
$page
->pressButton('Update');
$assert_session
->statusCodeEquals(200);
$page
->pressButton('Place');
$assert_session
->statusCodeEquals(200);
$assert_session
->fieldNotExists('Bundle');
$assert_session
->elementExists('css', '[role="alert"]');
$assert_session
->pageTextContains("Input did not match any media types: 'The quick brown fox gets eaten by hungry lions.'");
// The widget should not react if the input is valid, but the user does not
// have permission to create media of the matched type.
$page
->fillField('input', 'https://twitter.com/webchick/status/824051274353999872');
$page
->pressButton('Update');
$this
->assertEmpty($page
->findAll('css', '#entity *'));
}