mirror of
https://github.com/Respect/Validation.git
synced 2026-03-16 15:25:45 +01:00
We were not thoroughly testing quite a few rules, especially the constructor of some of them. This commit increases the code coverage, ensuring almost every single line in the "Rules" namespace is covered.
49 lines
1.3 KiB
PHP
49 lines
1.3 KiB
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\Group;
|
|
use Respect\Validation\Test\RuleTestCase;
|
|
use SplFileInfo;
|
|
use SplFileObject;
|
|
use stdClass;
|
|
|
|
#[Group('rule')]
|
|
#[CoversClass(Executable::class)]
|
|
final class ExecutableTest extends RuleTestCase
|
|
{
|
|
/** @return iterable<array{Executable, mixed}> */
|
|
public static function providerForValidInput(): iterable
|
|
{
|
|
$rule = new Executable();
|
|
|
|
return [
|
|
[$rule, 'tests/fixtures/executable'],
|
|
[$rule, new SplFileInfo('tests/fixtures/executable')],
|
|
[$rule, new SplFileObject('tests/fixtures/executable')],
|
|
];
|
|
}
|
|
|
|
/** @return iterable<array{Executable, mixed}> */
|
|
public static function providerForInvalidInput(): iterable
|
|
{
|
|
$rule = new Executable();
|
|
|
|
return [
|
|
[$rule, []],
|
|
[$rule, new stdClass()],
|
|
[$rule, null],
|
|
[$rule, 'tests/fixtures/valid-image.gif'],
|
|
[$rule, new SplFileInfo('tests/fixtures/valid-image.jpg')],
|
|
[$rule, new SplFileObject('tests/fixtures/valid-image.png')],
|
|
];
|
|
}
|
|
}
|