public function FileValidatorTest::testTooLargeKiloBytes

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/FileValidatorTest.php, line 110

Class

FileValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testTooLargeKiloBytes() {
  fwrite($this->file, str_repeat('0', 1400));
  $constraint = new File(array(
    'maxSize' => '1k',
    'maxSizeMessage' => 'myMessage',
  ));
  $this->context
    ->expects($this
    ->once())
    ->method('addViolation')
    ->with('myMessage', array(
    '{{ limit }}' => '1',
    '{{ size }}' => '1.4',
    '{{ suffix }}' => 'kB',
    '{{ file }}' => $this->path,
  ));
  $this->validator
    ->validate($this
    ->getFile($this->path), $constraint);
}