You are here

public function FileValidatorTest::testUploadedFileError in Plug 7

@dataProvider uploadedFileErrorProvider

File

lib/Symfony/validator/Symfony/Component/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();
}