Revision db2d93dd
Added by Benjamin Luce over 9 years ago
drupal7/modules/simpletest/tests/file.test | ||
---|---|---|
480 | 480 |
* Test file_validate_size(). |
481 | 481 |
*/ |
482 | 482 |
function testFileValidateSize() { |
483 |
global $user; |
|
484 |
$original_user = $user; |
|
485 |
drupal_save_session(FALSE); |
|
486 |
|
|
487 |
// Run these tests as a regular user. |
|
488 |
$user = $this->drupalCreateUser(); |
|
489 |
|
|
490 | 483 |
// Create a file with a size of 1000 bytes, and quotas of only 1 byte. |
491 | 484 |
$file = new stdClass(); |
492 | 485 |
$file->filesize = 1000; |
... | ... | |
498 | 491 |
$this->assertEqual(count($errors), 1, 'Error for the user being over their limit.', 'File'); |
499 | 492 |
$errors = file_validate_size($file, 1, 1); |
500 | 493 |
$this->assertEqual(count($errors), 2, 'Errors for both the file and their limit.', 'File'); |
501 |
|
|
502 |
$user = $original_user; |
|
503 |
drupal_save_session(TRUE); |
|
504 | 494 |
} |
505 | 495 |
} |
506 | 496 |
|
Also available in: Unified diff
Update to 7.37