diff options
Diffstat (limited to 'modules/file/tests/file.test')
-rw-r--r-- | modules/file/tests/file.test | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test index 69e711a36..4d53d747f 100644 --- a/modules/file/tests/file.test +++ b/modules/file/tests/file.test @@ -1167,5 +1167,18 @@ class FilePrivateTestCase extends FileFieldTestCase { // Ensure the file cannot be downloaded. $this->drupalGet(file_create_url($node_file->uri)); $this->assertResponse(403, 'Confirmed that access is denied for the file without view field access permission.'); + + // Attempt to reuse the existing file when creating a new node, and confirm + // that access is still denied. + $edit = array(); + $edit['title'] = $this->randomName(8); + $edit[$field_name . '[' . LANGUAGE_NONE . '][0][fid]'] = $node_file->fid; + $this->drupalPost('node/add/page', $edit, t('Save')); + $new_node = $this->drupalGetNodeByTitle($edit['title']); + $this->assertTrue(!empty($new_node), 'Node was created.'); + $this->assertUrl('node/' . $new_node->nid); + $this->assertNoRaw($node_file->filename, 'File without view field access permission does not appear after attempting to attach it to a new node.'); + $this->drupalGet(file_create_url($node_file->uri)); + $this->assertResponse(403, 'Confirmed that access is denied for the file without view field access permission after attempting to attach it to a new node.'); } } |