function SpaceUsedTest::testFileSpaceUsed
Same name in other branches
- 9 core/modules/file/tests/src/Kernel/SpaceUsedTest.php \Drupal\Tests\file\Kernel\SpaceUsedTest::testFileSpaceUsed()
- 10 core/modules/file/tests/src/Kernel/SpaceUsedTest.php \Drupal\Tests\file\Kernel\SpaceUsedTest::testFileSpaceUsed()
- 11.x core/modules/file/tests/src/Kernel/SpaceUsedTest.php \Drupal\Tests\file\Kernel\SpaceUsedTest::testFileSpaceUsed()
Test different users with the default status.
File
-
core/
modules/ file/ tests/ src/ Kernel/ SpaceUsedTest.php, line 57
Class
- SpaceUsedTest
- Tests the spaceUsed() function.
Namespace
Drupal\Tests\file\KernelCode
public function testFileSpaceUsed() {
$file = $this->container
->get('entity_type.manager')
->getStorage('file');
// Test different users with default status.
$this->assertEqual($file->spaceUsed(2), 70);
$this->assertEqual($file->spaceUsed(3), 300);
$this->assertEqual($file->spaceUsed(), 370);
// Test the status fields
$this->assertEqual($file->spaceUsed(NULL, 0), 4);
$this->assertEqual($file->spaceUsed(NULL, FILE_STATUS_PERMANENT), 370);
// Test both the user and status.
$this->assertEqual($file->spaceUsed(1, 0), 0);
$this->assertEqual($file->spaceUsed(1, FILE_STATUS_PERMANENT), 0);
$this->assertEqual($file->spaceUsed(2, 0), 1);
$this->assertEqual($file->spaceUsed(2, FILE_STATUS_PERMANENT), 70);
$this->assertEqual($file->spaceUsed(3, 0), 3);
$this->assertEqual($file->spaceUsed(3, FILE_STATUS_PERMANENT), 300);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.