You are here

private function MediaBrowserUploadWidgetTest::uploadFile in Lightning Media 8.3

Uploads a file in the media browser.

Parameters

string $path: The local path of the file to upload.

3 calls to MediaBrowserUploadWidgetTest::uploadFile()
MediaBrowserUploadWidgetTest::testDisambiguation in tests/src/Functional/MediaBrowserUploadWidgetTest.php
MediaBrowserUploadWidgetTest::testFieldAllowedTypesSettingIsRespected in tests/src/Functional/MediaBrowserUploadWidgetTest.php
MediaBrowserUploadWidgetTest::testInvalidInput in tests/src/Functional/MediaBrowserUploadWidgetTest.php

File

tests/src/Functional/MediaBrowserUploadWidgetTest.php, line 122

Class

MediaBrowserUploadWidgetTest
@group lightning_media

Namespace

Drupal\Tests\lightning_media\Functional

Code

private function uploadFile($path) {
  $this
    ->assertFileExists($path);
  $assert_session = $this
    ->assertSession();
  $file_field = $assert_session
    ->elementExists('css', '.js-form-managed-file');
  $file_field
    ->attachFileToField('File', $path);
  $file_field
    ->pressButton('Upload');
  $assert_session
    ->statusCodeEquals(200);
}