function FileEntityUnitTestCase::testFileEntity in File Entity (fieldable files) 7.2
Same name and namespace in other branches
- 7.3 file_entity.test \FileEntityUnitTestCase::testFileEntity()
Tests basic file entity properties.
File
- ./
file_entity.test, line 232 - Test integration for the file_entity module.
Class
- FileEntityUnitTestCase
- Tests basic file entity functionality.
Code
function testFileEntity() {
// Save a raw file, turning it into a file entity.
$file = $this
->getTestFile('text');
$file->uid = 1;
$file->status = FILE_STATUS_PERMANENT;
file_save($file);
// Test entity ID, revision ID, and bundle.
$ids = entity_extract_ids('file', $file);
$this
->assertIdentical($ids, array(
$file->fid,
NULL,
'document',
));
// Test the entity URI callback.
$uri = entity_uri('file', $file);
$this
->assertEqual($uri['path'], "file/{$file->fid}");
}