public function FileValidatorTest::testMaxSizeExceeded in Plug 7
@dataProvider provideMaxSizeExceededTests
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ FileValidatorTest.php, line 166
Class
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
public function testMaxSizeExceeded($bytesWritten, $limit, $sizeAsString, $limitAsString, $suffix) {
fseek($this->file, $bytesWritten - 1, SEEK_SET);
fwrite($this->file, '0');
fclose($this->file);
$constraint = new File(array(
'maxSize' => $limit,
'maxSizeMessage' => 'myMessage',
));
$this->validator
->validate($this
->getFile($this->path), $constraint);
$this
->buildViolation('myMessage')
->setParameter('{{ limit }}', $limitAsString)
->setParameter('{{ size }}', $sizeAsString)
->setParameter('{{ suffix }}', $suffix)
->setParameter('{{ file }}', '"' . $this->path . '"')
->setCode(File::TOO_LARGE_ERROR)
->assertRaised();
}