You are here

function FileValidatorTest::testFileValidateIsImage in SimpleTest 7

This ensures a specific file is actually an image.

File

tests/file.test, line 375
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 testFileValidateIsImage() {
  $this
    ->assertTrue(file_exists($this->image->uri), t('The image being tested exists.'), 'File');
  $errors = file_validate_is_image($this->image);
  $this
    ->assertEqual(count($errors), 0, t('No error reported for our image file.'), 'File');
  $this
    ->assertTrue(file_exists($this->non_image->uri), t('The non-image being tested exists.'), 'File');
  $errors = file_validate_is_image($this->non_image);
  $this
    ->assertEqual(count($errors), 1, t('An error reported for our non-image file.'), 'File');
}