You are here

public function FileValidatorTest::testValidWildcardMimeType in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\FileValidatorTest::testValidWildcardMimeType()

File

vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php, line 314

Class

FileValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testValidWildcardMimeType() {
  $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('image/jpg'));
  $constraint = new File(array(
    'mimeTypes' => array(
      'image/*',
    ),
  ));
  $this->validator
    ->validate($file, $constraint);
  $this
    ->assertNoViolation();
}