diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
index 7fcf35f..21b8565 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
@@ -20,6 +20,31 @@ public static function getInfo() {
   }
 
   /**
+   * Tests that files are not deleted when attached to a form with #access = hidden.
+   */
+  function testFileSaveAccessHidden() {
+    $type_name = 'article';
+    $field_name = strtolower($this->randomName());
+    $this->createFileField($field_name, $type_name);
+    $field = field_info_field($field_name);
+    $instance = field_info_instance('node', $field_name, $type_name);
+
+    $test_file = $this->getTestFile('image');
+    $nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
+    $node = node_load($nid, TRUE);
+
+    // Hide the file field on the form.
+    $edit = array(
+      'field_image' => array('#access' => FALSE),
+    );
+    // Save the node and ensure it does not have the file.
+    $this->drupalPost("node/$nid/edit", $edit, t('Save'));
+    $node = node_load($nid, TRUE);
+    $node_file = file_load($node->{$field_name}[LANGUAGE_NOT_SPECIFIED][0]['fid']);
+    $this->assertFileExists($node_file, t('File still exists.'));
+  }
+
+  /**
    * Tests upload and remove buttons for a single-valued File field.
    */
   function testSingleValuedWidget() {
