From be00a1ced4104d84df2f34b149b35fb0adf91093 Mon Sep 17 00:00:00 2001 From: David Rothstein Date: Wed, 19 Aug 2015 17:20:31 -0400 Subject: Drupal 7.39 --- modules/file/tests/file.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'modules/file/tests') diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test index 33d7afd1b..5c19d001f 100644 --- a/modules/file/tests/file.test +++ b/modules/file/tests/file.test @@ -377,6 +377,18 @@ class FileManagedFileElementTestCase extends FileFieldTestCase { $this->drupalPost($path, array(), t('Save')); $this->assertRaw(t('The file id is %fid.', array('%fid' => 0)), 'Submitted without a file.'); + // Submit with a file, but with an invalid form token. Ensure the file + // was not saved. + $last_fid_prior = $this->getLastFileId(); + $edit = array( + 'files[' . $input_base_name . ']' => drupal_realpath($test_file->uri), + 'form_token' => 'invalid token', + ); + $this->drupalPost($path, $edit, t('Save')); + $this->assertText('The form has become outdated. Copy any unsaved work in the form below'); + $last_fid = $this->getLastFileId(); + $this->assertEqual($last_fid_prior, $last_fid, 'File was not saved when uploaded with an invalid form token.'); + // Submit a new file, without using the Upload button. $last_fid_prior = $this->getLastFileId(); $edit = array('files[' . $input_base_name . ']' => drupal_realpath($test_file->uri)); -- cgit v1.2.3