public function FileValidatorTest::testInvalidWildcardMimeType in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\FileValidatorTest::testInvalidWildcardMimeType()
File
- vendor/
symfony/ validator/ Tests/ Constraints/ FileValidatorTest.php, line 368
Class
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
public function testInvalidWildcardMimeType() {
$file = $this
->getMockBuilder('Symfony\\Component\\HttpFoundation\\File\\File')
->setConstructorArgs(array(
__DIR__ . '/Fixtures/foo',
))
->getMock();
$file
->expects($this
->once())
->method('getPathname')
->will($this
->returnValue($this->path));
$file
->expects($this
->once())
->method('getMimeType')
->will($this
->returnValue('application/pdf'));
$constraint = new File(array(
'mimeTypes' => array(
'image/*',
'image/jpg',
),
'mimeTypesMessage' => 'myMessage',
));
$this->validator
->validate($file, $constraint);
$this
->buildViolation('myMessage')
->setParameter('{{ type }}', '"application/pdf"')
->setParameter('{{ types }}', '"image/*", "image/jpg"')
->setParameter('{{ file }}', '"' . $this->path . '"')
->setCode(File::INVALID_MIME_TYPE_ERROR)
->assertRaised();
}