public function MediaBrowserUploadWidgetTest::testDisambiguation in Lightning Media 8.3
Overrides MediaBrowserWidgetTestBase::testDisambiguation
File
- tests/
src/ Functional/ MediaBrowserUploadWidgetTest.php, line 91
Class
- MediaBrowserUploadWidgetTest
- @group lightning_media
Namespace
Drupal\Tests\lightning_media\FunctionalCode
public function testDisambiguation() {
$page = $this
->getSession()
->getPage();
$assert_session = $this
->assertSession();
FieldConfig::loadByName('media', 'image', 'image')
->setSetting('max_resolution', '100x100')
->save();
$this
->visitMediaBrowserFromNodeForm();
// Upload a 500x500 image.
$this
->uploadFile(__DIR__ . '/../../files/test.jpg');
$assert_session
->elementNotExists('css', '[role="contentinfo"]');
$page
->selectFieldOption('Bundle', 'Image');
$page
->pressButton('Update');
$assert_session
->statusCodeEquals(200);
$assert_session
->pageTextContains('Status message The image was resized to fit within the maximum allowed dimensions of 100x100 pixels. The new dimensions of the resized image are 100x100 pixels.');
$page
->fillField('Name', $this
->randomString());
$page
->fillField('Alternative text', $this
->randomString());
$page
->pressButton('Place');
$this
->assertMediaCount(1, [
'bundle' => 'image',
]);
}