You are here

public function IsbnValidatorTest::getInvalidIsbn13 in Plug 7

1 call to IsbnValidatorTest::getInvalidIsbn13()
IsbnValidatorTest::getInvalidIsbn in lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php

File

lib/Symfony/validator/Symfony/Component/Validator/Tests/Constraints/IsbnValidatorTest.php, line 90

Class

IsbnValidatorTest

Namespace

Symfony\Component\Validator\Tests\Constraints

Code

public function getInvalidIsbn13() {
  return array(
    array(
      '978-27234422821',
      Isbn::TOO_LONG_ERROR,
    ),
    array(
      '978-272344228',
      Isbn::TOO_SHORT_ERROR,
    ),
    array(
      '978-2723442-82',
      Isbn::TOO_SHORT_ERROR,
    ),
    array(
      '978-2723442281',
      Isbn::CHECKSUM_FAILED_ERROR,
    ),
    array(
      '978-0321513774',
      Isbn::CHECKSUM_FAILED_ERROR,
    ),
    array(
      '979-0431225385',
      Isbn::CHECKSUM_FAILED_ERROR,
    ),
    array(
      '980-0474292319',
      Isbn::CHECKSUM_FAILED_ERROR,
    ),
    array(
      '0-4X19-92619812',
      Isbn::INVALID_CHARACTERS_ERROR,
    ),
    array(
      '978_2723442282',
      Isbn::INVALID_CHARACTERS_ERROR,
    ),
    array(
      '978#2723442282',
      Isbn::INVALID_CHARACTERS_ERROR,
    ),
    array(
      '978-272C442282',
      Isbn::INVALID_CHARACTERS_ERROR,
    ),
    // chr(1) evaluates to 0
    // 978-2070546817 is valid
    array(
      '978-2' . chr(1) . '70546817',
      Isbn::INVALID_CHARACTERS_ERROR,
    ),
  );
}