You are here

public function ServicesResourceFileTests::testResourceFileDelete in Services 7.3

Same name and namespace in other branches
  1. 6.3 tests/functional/ServicesResourceFileTests.test \ServicesResourceFileTests::testResourceFileDelete()

Test delete method.

File

tests/functional/ServicesResourceFileTests.test, line 179
Test for file resource.

Class

ServicesResourceFileTests
Test class.

Code

public function testResourceFileDelete() {
  $testfile = $this->testfile;
  $testfile->fid = NULL;
  $testfile->uid = $this->privileged_user->uid;
  file_save($testfile);

  // Delete file via call.
  $result = $this
    ->servicesDelete($this->endpoint->path . '/file/' . $testfile->fid);

  // Try to load file.
  $file_load = file_load($testfile->fid);
  $this
    ->assertTrue(empty($file_load), 'File deleted.', 'FileResource: Delete');
}