mirror of
https://github.com/Respect/Validation.git
synced 2026-03-14 22:35:45 +01:00
This commit introduces REUSE compliance by annotating all files with SPDX information and placing the reused licences in the LICENSES folder. We additionally removed the docheader tool which is made obsolete by this change. The main LICENSE and copyright text of the project is now not under my personal name anymore, and it belongs to "The Respect Project Contributors" instead. This change restores author names to several files, giving the appropriate attribution for contributions.
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
/*
|
|
* SPDX-License-Identifier: MIT
|
|
* SPDX-FileCopyrightText: (c) Respect Project Contributors
|
|
* SPDX-FileContributor: Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-FileContributor: Danilo Correa <danilosilva87@gmail.com>
|
|
* SPDX-FileContributor: Henrique Moody <henriquemoody@gmail.com>
|
|
* SPDX-FileContributor: Moritz <moritzgitfromm@gmail.com>
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Validators;
|
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
use Respect\Validation\Test\RuleTestCase;
|
|
use stdClass;
|
|
|
|
#[Group('validator')]
|
|
#[CoversClass(Isbn::class)]
|
|
final class IsbnTest extends RuleTestCase
|
|
{
|
|
/** @return iterable<array{Isbn, mixed}> */
|
|
public static function providerForValidInput(): iterable
|
|
{
|
|
$sut = new Isbn();
|
|
|
|
return [
|
|
[$sut, 'ISBN-13: 978-0-596-52068-7'],
|
|
[$sut, '978 0 596 52068 7'],
|
|
[$sut, '9780596520687'],
|
|
[$sut, '0-596-52068-9'],
|
|
[$sut, '0 512 52068 9'],
|
|
[$sut, 'ISBN-10 0-596-52068-9'],
|
|
[$sut, 'ISBN-10: 0-596-52068-9'],
|
|
];
|
|
}
|
|
|
|
/** @return iterable<array{Isbn, mixed}> */
|
|
public static function providerForInvalidInput(): iterable
|
|
{
|
|
$sut = new Isbn();
|
|
|
|
return [
|
|
[$sut, []],
|
|
[$sut, null],
|
|
[$sut, new stdClass()],
|
|
[$sut, 'ISBN 11978-0-596-52068-7'],
|
|
[$sut, 'ISBN-12: 978-0-596-52068-7'],
|
|
[$sut, '978 10 596 52068 7'],
|
|
[$sut, '119780596520687'],
|
|
[$sut, '0-5961-52068-9'],
|
|
[$sut, '11 5122 52068 9'],
|
|
[$sut, 'ISBN-11 0-596-52068-9'],
|
|
[$sut, 'ISBN-10- 0-596-52068-9'],
|
|
[$sut, 'Defiatly no ISBN'],
|
|
[$sut, 'Neither ISBN-13: 978-0-596-52068-7'],
|
|
];
|
|
}
|
|
}
|