Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
|
@ -7,8 +7,10 @@
|
|||
|
||||
namespace Drupal\file\Tests;
|
||||
|
||||
use Drupal\file\Entity\File;
|
||||
|
||||
/**
|
||||
* Tests the file_load() function.
|
||||
* Tests \Drupal\file\Entity\File::load().
|
||||
*
|
||||
* @group file
|
||||
*/
|
||||
|
|
@ -17,7 +19,7 @@ class LoadTest extends FileManagedUnitTestBase {
|
|||
* Try to load a non-existent file by fid.
|
||||
*/
|
||||
function testLoadMissingFid() {
|
||||
$this->assertFalse(file_load(-1), 'Try to load an invalid fid fails.');
|
||||
$this->assertFalse(File::load(-1), 'Try to load an invalid fid fails.');
|
||||
$this->assertFileHooksCalled(array());
|
||||
}
|
||||
|
||||
|
|
@ -45,10 +47,9 @@ class LoadTest extends FileManagedUnitTestBase {
|
|||
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());
|
||||
$by_fid_file = File::load($file->id());
|
||||
$this->assertFileHookCalled('load');
|
||||
$this->assertTrue(is_object($by_fid_file), 'file_load() returned an object.');
|
||||
$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');
|
||||
|
|
@ -68,16 +69,16 @@ class LoadTest extends FileManagedUnitTestBase {
|
|||
file_test_reset();
|
||||
$by_path_files = entity_load_multiple_by_properties('file', array('uri' => $file->getFileUri()));
|
||||
$this->assertFileHookCalled('load');
|
||||
$this->assertEqual(1, count($by_path_files), 'file_load_multiple() returned an array of the correct size.');
|
||||
$this->assertEqual(1, count($by_path_files), 'entity_load_multiple_by_properties() returned an array of the correct size.');
|
||||
$by_path_file = reset($by_path_files);
|
||||
$this->assertTrue($by_path_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
|
||||
$this->assertEqual($by_path_file->id(), $file->id(), 'Loading by filepath got the correct fid.', 'File');
|
||||
|
||||
// Load by fid.
|
||||
file_test_reset();
|
||||
$by_fid_files = file_load_multiple(array($file->id()));
|
||||
$by_fid_files = File::loadMultiple(array($file->id()));
|
||||
$this->assertFileHooksCalled(array());
|
||||
$this->assertEqual(1, count($by_fid_files), 'file_load_multiple() returned an array of the correct size.');
|
||||
$this->assertEqual(1, count($by_fid_files), '\Drupal\file\Entity\File::loadMultiple() returned an array of the correct size.');
|
||||
$by_fid_file = reset($by_fid_files);
|
||||
$this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
|
||||
$this->assertEqual($by_fid_file->getFileUri(), $file->getFileUri(), 'Loading by fid got the correct filepath.', 'File');
|
||||
|
|
|
|||
Reference in a new issue