function SpaceUsedTest::testFileSpaceUsed
Same name in other branches
- 8.9.x 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()
Tests different users with the default status.
File
-
core/
modules/ file/ tests/ src/ Kernel/ SpaceUsedTest.php, line 61
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->assertEquals(70, $file->spaceUsed(2));
$this->assertEquals(300, $file->spaceUsed(3));
$this->assertEquals(370, $file->spaceUsed());
// Test the status fields
$this->assertEquals(4, $file->spaceUsed(NULL, 0));
$this->assertEquals(370, $file->spaceUsed());
// Test both the user and status.
$this->assertEquals(0, $file->spaceUsed(1, 0));
$this->assertEquals(0, $file->spaceUsed(1));
$this->assertEquals(1, $file->spaceUsed(2, 0));
$this->assertEquals(70, $file->spaceUsed(2));
$this->assertEquals(3, $file->spaceUsed(3, 0));
$this->assertEquals(300, $file->spaceUsed(3));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.