You are here

public function IsbnValidatorTest::testInvalidIsbnAnyIsbn13 in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php \Symfony\Component\Validator\Tests\Constraints\IsbnValidatorTest::testInvalidIsbnAnyIsbn13()

@dataProvider getInvalidIsbn13

File

vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php, line 253

Class

IsbnValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function testInvalidIsbnAnyIsbn13($isbn, $code) {
  $constraint = new Isbn(array(
    'bothIsbnMessage' => 'myMessage',
  ));
  $this->validator
    ->validate($isbn, $constraint);

  // Too short for an ISBN-13, but not short enough for an ISBN-10
  if (Isbn::TOO_SHORT_ERROR === $code) {
    $code = Isbn::TYPE_NOT_RECOGNIZED_ERROR;
  }
  $this
    ->buildViolation('myMessage')
    ->setParameter('{{ value }}', '"' . $isbn . '"')
    ->setCode($code)
    ->assertRaised();
}