function LoadTest::testSingleValues in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/LoadTest.php \Drupal\file\Tests\LoadTest::testSingleValues()
Load a single file and ensure that the correct values are returned.
File
- core/
modules/ file/ src/ Tests/ LoadTest.php, line 47 - Contains \Drupal\file\Tests\LoadTest.
Class
- LoadTest
- Tests \Drupal\file\Entity\File::load().
Namespace
Drupal\file\TestsCode
function testSingleValues() {
// Create a new file entity from scratch so we know the values.
$file = $this
->createFile('druplicon.txt', NULL, 'public');
$by_fid_file = File::load($file
->id());
$this
->assertFileHookCalled('load');
$this
->assertTrue(is_object($by_fid_file), '\\Drupal\\file\\Entity\\File::load() returned an object.');
$this
->assertEqual($by_fid_file
->id(), $file
->id(), 'Loading by fid got the same fid.', 'File');
$this
->assertEqual($by_fid_file
->getFileUri(), $file
->getFileUri(), 'Loading by fid got the correct filepath.', 'File');
$this
->assertEqual($by_fid_file
->getFilename(), $file
->getFilename(), 'Loading by fid got the correct filename.', 'File');
$this
->assertEqual($by_fid_file
->getMimeType(), $file
->getMimeType(), 'Loading by fid got the correct MIME type.', 'File');
$this
->assertEqual($by_fid_file
->isPermanent(), $file
->isPermanent(), 'Loading by fid got the correct status.', 'File');
$this
->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
}