respect-validation/tests/unit/Rules/ResourceTypeTest.php
Henrique Moody b2250c65a0
Improve how we handle data providers
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>
2024-03-17 22:30:23 +01:00

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);
}
}