Image uploads are getting deleted after test case run

Created on 21 August 2017, over 7 years ago
Updated 22 October 2024, about 2 months ago

The following code is working fine for uploading images. The node is being created but the uploaded images (under /sites/default/files/simpletest) are getting deleted after each complete test suite run.

Here the sample code

    public function testBundleCreate() {
      $edit = array();
      $edit['title'] = $this->randomName(8);
      $edit["field_description[und][0][value]"] = $this->randomName(16);
      $field_name = 'my_image';
      $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = 'sites/default/files/test-image.png'; // existed
      $this->drupalPost('node/add/quests', $edit, t('Save'));
      $this->drupalGet("node/1/edit");
      }

Screenshot

Getting 404 not found for the image path (sites/default/files/simpletest/505284/test-image.png)

Any suggestions?

💬 Support request
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024