You are here

public function FileValidatorTest::testUploadedFileError in Zircon Profile 8.0

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

@dataProvider uploadedFileErrorProvider

File

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

Class

FileValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testUploadedFileError($error, $message, array $params = array(), $maxSize = null) {
  $file = new UploadedFile('/path/to/file', 'originalName', 'mime', 0, $error);
  $constraint = new File(array(
    $message => 'myMessage',
    'maxSize' => $maxSize,
  ));
  $this->validator
    ->validate($file, $constraint);
  $this
    ->buildViolation('myMessage')
    ->setParameters($params)
    ->setCode($error)
    ->assertRaised();
}