You are here

public function FileValidatorTest::testDisallowEmpty 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::testDisallowEmpty()

File

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

Class

FileValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testDisallowEmpty() {
  ftruncate($this->file, 0);
  $constraint = new File(array(
    'disallowEmptyMessage' => 'myMessage',
  ));
  $this->validator
    ->validate($this
    ->getFile($this->path), $constraint);
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ file }}', '"' . $this->path . '"')
    ->setCode(File::EMPTY_ERROR)
    ->assertRaised();
}