mirror of
https://github.com/Respect/Validation.git
synced 2024-06-26 17:20:16 +02:00
b2250c65a0
We frequently repeat ourselves in the data providers. There's a clear advantage to that, as it increases the number of possibilities with the test, but it can also be annoying when we have to repeat ourselves. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
36 lines
886 B
PHP
36 lines
886 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Respect\Validation\Rules;
|
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use Respect\Validation\Test\TestCase;
|
|
|
|
#[Group('rule')]
|
|
#[CoversClass(ResourceType::class)]
|
|
final class ResourceTypeTest extends TestCase
|
|
{
|
|
#[Test]
|
|
#[DataProvider('providerForResourceType')]
|
|
public function shouldValidateValidInput(mixed $input): void
|
|
{
|
|
self::assertValidInput(new ResourceType(), $input);
|
|
}
|
|
|
|
#[Test]
|
|
#[DataProvider('providerForNonResourceType')]
|
|
public function shouldValidateInvalidInput(mixed $input): void
|
|
{
|
|
self::assertInvalidInput(new ResourceType(), $input);
|
|
}
|
|
}
|