function FileValidatorTest::testFileValidateIsImage
This ensures a specific file is actually an image.
File
-
modules/
simpletest/ tests/ file.test, line 406
Class
- FileValidatorTest
- This will run tests against the file validation functions (file_validate_*).
Code
function testFileValidateIsImage() {
$this->assertTrue(file_exists($this->image->uri), 'The image being tested exists.', 'File');
$errors = file_validate_is_image($this->image);
$this->assertEqual(count($errors), 0, 'No error reported for our image file.', 'File');
$this->assertTrue(file_exists($this->non_image->uri), 'The non-image being tested exists.', 'File');
$errors = file_validate_is_image($this->non_image);
$this->assertEqual(count($errors), 1, 'An error reported for our non-image file.', 'File');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.