public function ImageValidatorTest::testWidthTooBig

File

drupal/core/vendor/symfony/validator/Symfony/Component/Validator/Tests/Constraints/ImageValidatorTest.php, line 100

Class

ImageValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testWidthTooBig() {
  if (!class_exists('Symfony\\Component\\HttpFoundation\\File\\File')) {
    $this
      ->markTestSkipped('The "HttpFoundation" component is not available');
  }
  $constraint = new Image(array(
    'maxWidth' => 1,
    'maxWidthMessage' => 'myMessage',
  ));
  $this->context
    ->expects($this
    ->once())
    ->method('addViolation')
    ->with('myMessage', array(
    '{{ width }}' => '2',
    '{{ max_width }}' => '1',
  ));
  $this->validator
    ->validate($this->image, $constraint);
}