1 file.test FileSpaceUsedTest::testFileSpaceUsed()

Test different users with the default status.

File

core/modules/simpletest/tests/file.test, line 334
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Class

FileSpaceUsedTest
This will run tests against the file_space_used() function.

Code

function testFileSpaceUsed() {
  // Test different users with default status.
  $this->assertEqual(file_space_used(2), 70);
  $this->assertEqual(file_space_used(3), 300);
  $this->assertEqual(file_space_used(), 370);

  // Test the status fields
  $this->assertEqual(file_space_used(NULL, 0), 4);
  $this->assertEqual(file_space_used(NULL, FILE_STATUS_PERMANENT), 370);

  // Test both the user and status.
  $this->assertEqual(file_space_used(1, 0), 0);
  $this->assertEqual(file_space_used(1, FILE_STATUS_PERMANENT), 0);
  $this->assertEqual(file_space_used(2, 0), 1);
  $this->assertEqual(file_space_used(2, FILE_STATUS_PERMANENT), 70);
  $this->assertEqual(file_space_used(3, 0), 3);
  $this->assertEqual(file_space_used(3, FILE_STATUS_PERMANENT), 300);
}