Révision b4adf10d
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/modules/simpletest/tests/file.test | ||
---|---|---|
484 | 484 |
$original_user = $user; |
485 | 485 |
drupal_save_session(FALSE); |
486 | 486 |
|
487 |
// Run these test as uid = 1. |
|
488 |
$user = user_load(1); |
|
489 |
|
|
490 |
$file = new stdClass(); |
|
491 |
$file->filesize = 999999; |
|
492 |
$errors = file_validate_size($file, 1, 1); |
|
493 |
$this->assertEqual(count($errors), 0, 'No size limits enforced on uid=1.', 'File'); |
|
494 |
|
|
495 | 487 |
// Run these tests as a regular user. |
496 | 488 |
$user = $this->drupalCreateUser(); |
497 | 489 |
|
... | ... | |
2564 | 2556 |
parent::setUp(); |
2565 | 2557 |
$this->bad_extension = 'php'; |
2566 | 2558 |
$this->name = $this->randomName() . '.' . $this->bad_extension . '.txt'; |
2559 |
$this->name_with_uc_ext = $this->randomName() . '.' . strtoupper($this->bad_extension) . '.txt'; |
|
2567 | 2560 |
} |
2568 | 2561 |
|
2569 | 2562 |
/** |
... | ... | |
2601 | 2594 |
* White listed extensions are ignored by file_munge_filename(). |
2602 | 2595 |
*/ |
2603 | 2596 |
function testMungeIgnoreWhitelisted() { |
2604 |
// Declare our extension as whitelisted. |
|
2605 |
$munged_name = file_munge_filename($this->name, $this->bad_extension); |
|
2606 |
$this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name))); |
|
2597 |
// Declare our extension as whitelisted. The declared extensions should |
|
2598 |
// be case insensitive so test using one with a different case. |
|
2599 |
$munged_name = file_munge_filename($this->name_with_uc_ext, $this->bad_extension); |
|
2600 |
$this->assertIdentical($munged_name, $this->name_with_uc_ext, format_string('The new filename (%munged) matches the original (%original) once the extension has been whitelisted.', array('%munged' => $munged_name, '%original' => $this->name_with_uc_ext))); |
|
2601 |
// The allowed extensions should also be normalized. |
|
2602 |
$munged_name = file_munge_filename($this->name, strtoupper($this->bad_extension)); |
|
2603 |
$this->assertIdentical($munged_name, $this->name, format_string('The new filename (%munged) matches the original (%original) also when the whitelisted extension is in uppercase.', array('%munged' => $munged_name, '%original' => $this->name))); |
|
2607 | 2604 |
} |
2608 | 2605 |
|
2609 | 2606 |
/** |
Formats disponibles : Unified diff
Udpate to 7.33