You are here

public function ServicesResourceFileTests::testResourceFileRetrieve in Services 6.3

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

Test retrieve method.

File

tests/functional/ServicesResourceFileTests.test, line 129

Class

ServicesResourceFileTests
Test class.

Code

public function testResourceFileRetrieve() {

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

  // Retrieve file.
  $result = $this
    ->servicesGet($this->endpoint->path . '/file/' . $testfile['fid']);
  $file = $result['body'];

  // Assert that fid, filesize and uri are the same.
  $this
    ->assertTrue($file['fid'] == $testfile['fid'] && $file['filesize'] == $testfile['filesize'], t('File retrieved.'), 'FileResource: Retrieve');
}