You are here

function FileValidatorTest::testFileValidateExtensions in SimpleTest 7

Test the file_validate_extensions() function.

File

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

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, t('Valid extension accepted.'), 'File');
  $file->filename = 'asdf.txt';
  $errors = file_validate_extensions($file, 'exe png');
  $this
    ->assertEqual(count($errors), 1, t('Invalid extension blocked.'), 'File');
}