respect-validation/tests/unit/Validators/WhenTest.php
Alexandre Gomes Gaigalas d9cdc118b2 Introduce REUSE compliance
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.
2026-01-21 06:28:11 +00:00

47 lines
1.7 KiB
PHP

<?php
/*
* SPDX-License-Identifier: MIT
* SPDX-FileCopyrightText: (c) Respect Project Contributors
* SPDX-FileContributor: Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-FileContributor: Antonio Spinelli <tonicospinelli85@gmail.com>
* SPDX-FileContributor: Danilo Correa <danilosilva87@gmail.com>
* SPDX-FileContributor: Henrique Moody <henriquemoody@gmail.com>
* SPDX-FileContributor: Nick Lombard <github@jigsoft.co.za>
*/
declare(strict_types=1);
namespace Respect\Validation\Validators;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Respect\Validation\Test\RuleTestCase;
use Respect\Validation\Test\Validators\Stub;
use function rand;
#[Group('validator')]
#[CoversClass(When::class)]
final class WhenTest extends RuleTestCase
{
/** @return array<array{When, mixed}> */
public static function providerForValidInput(): array
{
return [
'when fail, then pass' => [new When(Stub::pass(1), Stub::pass(1)), rand()],
'when pass, then pass, else daze' => [new When(Stub::pass(1), Stub::pass(1), Stub::daze()), rand()],
'when fail, then daze, else pass' => [new When(Stub::fail(1), Stub::daze(), Stub::pass(1)), rand()],
];
}
/** @return array<array{When, mixed}> */
public static function providerForInvalidInput(): array
{
return [
'when pass, then fail' => [new When(Stub::pass(1), Stub::fail(1)), rand()],
'when pass, then fail, else daze' => [new When(Stub::pass(1), Stub::fail(1), Stub::daze()), rand()],
'when fail, then daze, else fail' => [new When(Stub::fail(1), Stub::daze(), Stub::fail(1)), rand()],
];
}
}