mirror of
https://github.com/Respect/Validation.git
synced 2024-06-03 06:12:17 +02:00
c946f16f60
Just to make the root directory cleaner. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
44 lines
1.1 KiB
PHP
44 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;
|
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use Respect\Validation\Exceptions\ComponentException;
|
|
use Respect\Validation\Test\TestCase;
|
|
|
|
#[CoversClass(Validator::class)]
|
|
final class ValidatorTest extends TestCase
|
|
{
|
|
#[Test]
|
|
public function staticCreateShouldReturnNewValidator(): void
|
|
{
|
|
self::assertInstanceOf(Validator::class, Validator::create());
|
|
}
|
|
|
|
#[Test]
|
|
public function invalidRuleClassShouldThrowComponentException(): void
|
|
{
|
|
$this->expectException(ComponentException::class);
|
|
|
|
// @phpstan-ignore-next-line
|
|
Validator::iDoNotExistSoIShouldThrowException();
|
|
}
|
|
|
|
#[Test]
|
|
public function shouldReturnValidatorInstanceWhenTheNotRuleIsCalledWithArguments(): void
|
|
{
|
|
$validator = Validator::create();
|
|
|
|
// @phpstan-ignore-next-line
|
|
self::assertSame($validator, $validator->not($validator->notEmpty()));
|
|
}
|
|
}
|