reverted: --- b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php +++ a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php @@ -29,44 +29,6 @@ } /** - * Tests that files are not deleted when attached to a form with #access = hidden. - */ - function testFileSaveAccessHidden() { - //$node_controller = $this->container->get('plugin.manager.entity')->getStorageController('node'); - $node_controller = $this->container->get('entity.manager')->getStorage('node'); - $file_controller = $this->container->get('entity.manager')->getStorage('file'); - - // Add a file field to the test content type. - $type = $this->drupalCreateContentType(); - //debug($type->getOriginalId()); - $field_name = 'hidden_file_field'; - $this->createFileField($field_name, $type->getEntityType()->getBundleOf(), $type->getOriginalId()); - - // Create a node with an uploaded file in the field. - $test_file = $this->getTestFile('text'); - $nid = $this->uploadNodeFile($test_file, $field_name, $type->getOriginalId()); - - $this->drupalGet("node/$nid/edit"); - - // Hide file field by enabling helper module. - $this->container->get('module_handler')->install(array('file_test_hidden')); - - $this->drupalGet("node/$nid"); - - // Save the node and ensure the file is not deleted. - $this->drupalPostForm("node/$nid/edit", array(), t('Save and keep published')); - $node_controller->resetCache(array($nid)); - $node = $node_controller->load($nid); - - $this->drupalGet("node/$nid"); - $node_file = $file_controller->load($node->{$field_name}->target_id); - $this->assertFileExists($node_file, 'File still exists.'); - - // Disable helper module. - $this->container->get('module_handler')->uninstall(array('file_test_hidden')); - } - - /** * Tests upload and remove buttons for a single-valued File field. */ function testSingleValuedWidget() { only in patch2: unchanged: --- a/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -30,6 +30,44 @@ class FileFieldWidgetTest extends FileFieldTestBase { public static $modules = array('comment'); /** + * Tests that files are not deleted when attached to a form with #access = hidden. + */ + function testFileSaveAccessHidden() { + //$node_controller = $this->container->get('plugin.manager.entity')->getStorageController('node'); + $node_controller = $this->container->get('entity.manager')->getStorage('node'); + $file_controller = $this->container->get('entity.manager')->getStorage('file'); + + // Add a file field to the test content type. + $type = $this->drupalCreateContentType(); + //debug($type->getOriginalId()); + $field_name = 'hidden_file_field'; + $this->createFileField($field_name, $type->getEntityType()->getBundleOf(), $type->getOriginalId()); + + // Create a node with an uploaded file in the field. + $test_file = $this->getTestFile('text'); + $nid = $this->uploadNodeFile($test_file, $field_name, $type->getOriginalId()); + + $this->drupalGet("node/$nid/edit"); + + // Hide file field by enabling helper module. + $this->container->get('module_handler')->install(array('file_test_hidden')); + + $this->drupalGet("node/$nid"); + + // Save the node and ensure the file is not deleted. + $this->drupalPostForm("node/$nid/edit", array(), t('Save and keep published')); + $node_controller->resetCache(array($nid)); + $node = $node_controller->load($nid); + + $this->drupalGet("node/$nid"); + $node_file = $file_controller->load($node->{$field_name}->target_id); + $this->assertFileExists($node_file, 'File still exists.'); + + // Disable helper module. + $this->container->get('module_handler')->uninstall(array('file_test_hidden')); + } + + /** * Tests upload and remove buttons for a single-valued File field. */ function testSingleValuedWidget() {