function ValidatorTest::testFileValidateIsImage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/file/src/Tests/ValidatorTest.php \Drupal\file\Tests\ValidatorTest::testFileValidateIsImage()
This ensures a specific file is actually an image.
File
- core/
modules/ file/ src/ Tests/ ValidatorTest.php, line 59 - Contains \Drupal\file\Tests\ValidatorTest.
Class
- ValidatorTest
- Tests the functions used to validate uploaded files.
Namespace
Drupal\file\TestsCode
function testFileValidateIsImage() {
$this
->assertTrue(file_exists($this->image
->getFileUri()), '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->nonImage
->getFileUri()), 'The non-image being tested exists.', 'File');
$errors = file_validate_is_image($this->nonImage);
$this
->assertEqual(count($errors), 1, 'An error reported for our non-image file.', 'File');
}