respect-validation/tests/unit/Rules/ArrayValTest.php
Henrique Moody 12c145756c
Upgrade "phpunit/phpunit"
This commit also replaces PHPUnit annotations with attributes.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-01-28 14:16:52 +01:00

54 lines
1.1 KiB
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation\Rules;
use ArrayObject;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Group;
use Respect\Validation\Test\RuleTestCase;
use SimpleXMLElement;
use stdClass;
#[Group(' rule')]
#[CoversClass(ArrayVal::class)]
final class ArrayValTest extends RuleTestCase
{
/**
* @return array<array{ArrayVal, mixed}>
*/
public static function providerForValidInput(): array
{
$rule = new ArrayVal();
return [
[$rule, []],
[$rule, [1, 2, 3]],
[$rule, new ArrayObject()],
[$rule, new SimpleXMLElement('<foo></foo>')],
];
}
/**
* @return array<array{ArrayVal, mixed}>
*/
public static function providerForInvalidInput(): array
{
$rule = new ArrayVal();
return [
[$rule, ''],
[$rule, null],
[$rule, 121],
[$rule, new stdClass()],
[$rule, false],
[$rule, 'aaa'],
];
}
}