public function FileValidatorTest::testBinaryFormat in Plug 7
@dataProvider provideBinaryFormatTests
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Constraints/ FileValidatorTest.php, line 267
Class
Namespace
Symfony\Component\Validator\Tests\ConstraintsCode
public function testBinaryFormat($bytesWritten, $limit, $binaryFormat, $sizeAsString, $limitAsString, $suffix) {
fseek($this->file, $bytesWritten - 1, SEEK_SET);
fwrite($this->file, '0');
fclose($this->file);
$constraint = new File(array(
'maxSize' => $limit,
'binaryFormat' => $binaryFormat,
'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();
}