diff --git a/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php b/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php index 4c8c94bc08..7ecc1b7e42 100644 --- a/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php +++ b/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php @@ -53,8 +53,6 @@ public function testManyConsecutiveUploads() { ]); $this->drupalLogin($user); - /** @var \Drupal\Core\File\FileSystemInterface $file_system */ - $file_system = $this->container->get('file_system'); // Visit a node create page and open the media library. $this->drupalGet('node/add/basic_page'); @@ -66,8 +64,9 @@ public function testManyConsecutiveUploads() { $this->waitForText('Add or select media', 10000, "Text 'Add or select media' not appear on iteration $count"); $this->clickTypeTab('Four'); $new_filename = uniqid() . '.jpg'; - $new_filepath = $file_system->realpath('public://') . '/' . $new_filename; - copy($file_system->realpath($jpg_image->uri), $new_filepath); + $new_filepath = $this->container->get('file_system')->realpath('public://') . '/' . $new_filename; + $new_uri = $this->container->get('file_system')->copy($jpg_image->uri, $new_filepath); + $new_filepath = $this->container->get('file_system')->realpath($new_uri); $this->waitForFieldExists('Add files', 10000, "Did not find 'Add files' on iteration $count"); $page->attachFileToField('Add files', $new_filepath); $this->waitForText('Alternative text', 10000, "Alternative text field not found on iteration $count"); @@ -85,7 +84,6 @@ public function testManyConsecutiveUploads() { $this->waitForText('One media item remaining', 10000, "'One media item remaining' not found on iteration $count"); $this->assertElementExistsAfterWait('css', '[name="field_twin_media-0-media-library-remove-button"]', 10000, "Media remove button not found on iteration $count")->click(); $this->waitForText('2 media items remaining', 10000, "'2 media items remaining' not found on iteration $count"); - $this->getSession()->reload(); $count++; usleep(10000); }