X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Ffile%2Fsrc%2FTests%2FFileFieldWidgetTest.php;h=8017ebf1b25dd88fef5bc93f19700778184de76b;hb=74df008bdbb3a11eeea356744f39b802369bda3c;hp=ddfd8f4e79b1c355b5c5cc758f230ef5ed0b424f;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/file/src/Tests/FileFieldWidgetTest.php b/web/core/modules/file/src/Tests/FileFieldWidgetTest.php index ddfd8f4e7..8017ebf1b 100644 --- a/web/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/web/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -121,7 +121,7 @@ class FileFieldWidgetTest extends FileFieldTestBase { $this->assertTrue(isset($label[0]), 'Label for upload found.'); // Save the node and ensure it does not have the file. - $this->drupalPostForm(NULL, [], t('Save and keep published')); + $this->drupalPostForm(NULL, [], t('Save')); $node_storage->resetCache([$nid]); $node = $node_storage->load($nid); $this->assertTrue(empty($node->{$field_name}->target_id), 'File was successfully removed from the node.'); @@ -160,7 +160,7 @@ class FileFieldWidgetTest extends FileFieldTestBase { $this->drupalGet("node/add/$type_name"); foreach ([$field_name2, $field_name] as $each_field_name) { for ($delta = 0; $delta < 3; $delta++) { - $edit = ['files[' . $each_field_name . '_' . $delta . '][]' => drupal_realpath($test_file->getFileUri())]; + $edit = ['files[' . $each_field_name . '_' . $delta . '][]' => \Drupal::service('file_system')->realpath($test_file->getFileUri())]; // If the Upload button doesn't exist, drupalPostForm() will automatically // fail with an assertion message. $this->drupalPostForm(NULL, $edit, t('Upload')); @@ -238,8 +238,7 @@ class FileFieldWidgetTest extends FileFieldTestBase { $this->assertNoFieldByXPath('//input[@type="submit"]', t('Remove'), format_string('After removing all files, there is no "Remove" button displayed (JSMode=%type).', ['%type' => $type])); // Save the node and ensure it does not have any files. - $this->drupalPostForm(NULL, ['title[0][value]' => $this->randomMachineName()], t('Save and publish')); - $matches = []; + $this->drupalPostForm(NULL, ['title[0][value]' => $this->randomMachineName()], t('Save')); preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches); $nid = $matches[1]; $node_storage->resetCache([$nid]); @@ -368,13 +367,13 @@ class FileFieldWidgetTest extends FileFieldTestBase { $edit = [ 'title[0][value]' => $this->randomMachineName(), ]; - $this->drupalPostForm('node/add/article', $edit, t('Save and publish')); + $this->drupalPostForm('node/add/article', $edit, t('Save')); $node = $this->drupalGetNodeByTitle($edit['title[0][value]']); // Add a comment with a file. $text_file = $this->getTestFile('text'); $edit = [ - 'files[field_' . $name . '_' . 0 . ']' => drupal_realpath($text_file->getFileUri()), + 'files[field_' . $name . '_' . 0 . ']' => \Drupal::service('file_system')->realpath($text_file->getFileUri()), 'comment_body[0][value]' => $comment_body = $this->randomMachineName(), ]; $this->drupalPostForm('node/' . $node->id(), $edit, t('Save')); @@ -402,7 +401,8 @@ class FileFieldWidgetTest extends FileFieldTestBase { // Unpublishes node. $this->drupalLogin($this->adminUser); - $this->drupalPostForm('node/' . $node->id() . '/edit', [], t('Save and unpublish')); + $edit = ['status[value]' => FALSE]; + $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save')); // Ensures normal user can no longer download the file. $this->drupalLogin($user); @@ -429,7 +429,7 @@ class FileFieldWidgetTest extends FileFieldTestBase { $name = 'files[' . $field_name . '_0]'; // Upload file with incorrect extension, check for validation error. - $edit[$name] = drupal_realpath($test_file_image->getFileUri()); + $edit[$name] = \Drupal::service('file_system')->realpath($test_file_image->getFileUri()); switch ($type) { case 'nojs': $this->drupalPostForm(NULL, $edit, t('Upload')); @@ -443,7 +443,7 @@ class FileFieldWidgetTest extends FileFieldTestBase { $this->assertRaw($error_message, t('Validation error when file with wrong extension uploaded (JSMode=%type).', ['%type' => $type])); // Upload file with correct extension, check that error message is removed. - $edit[$name] = drupal_realpath($test_file_text->getFileUri()); + $edit[$name] = \Drupal::service('file_system')->realpath($test_file_text->getFileUri()); switch ($type) { case 'nojs': $this->drupalPostForm(NULL, $edit, t('Upload'));