You are here

public function FileValidatorTest::testDisallowEmpty in Plug 7

File

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