You are here

public function ServicesResourceFileTests::testResourceFileDelete in Services 6.3

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

Test delete method.

File

tests/functional/ServicesResourceFileTests.test, line 146

Class

ServicesResourceFileTests
Test class.

Code

public function testResourceFileDelete() {

  // Emulate uploaded file.
  $testfile = $this
    ->uploadTestFile();

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

  // Check if record in files table still exists.
  $fid = db_result(db_query('SELECT fid FROM {files} WHERE fid = %d', $testfile['fid']));
  $this
    ->assertTrue(empty($fid), t('File deleted.'), 'FileResource: Delete');
}