public function SpaceUsedTest::testFileSpaceUsed in Drupal 9
Same name and namespace in other branches
- 8 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()
Tests different users with the default status.
File
- core/
modules/ file/ tests/ src/ Kernel/ SpaceUsedTest.php, line 58
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));
}