function FileValidatorTest::testFileValidateExtensions
Test the file_validate_extensions() function.
File
-
modules/
simpletest/ tests/ file.test, line 392
Class
- FileValidatorTest
- This will run tests against the file validation functions (file_validate_*).
Code
function testFileValidateExtensions() {
$file = new stdClass();
$file->filename = 'asdf.txt';
$errors = file_validate_extensions($file, 'asdf txt pork');
$this->assertEqual(count($errors), 0, 'Valid extension accepted.', 'File');
$file->filename = 'asdf.txt';
$errors = file_validate_extensions($file, 'exe png');
$this->assertEqual(count($errors), 1, 'Invalid extension blocked.', 'File');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.