mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 15:50:03 +01:00
This commit also replaces PHPUnit annotations with attributes. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
40 lines
1 KiB
PHP
40 lines
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);
|
|
Validator::iDoNotExistSoIShouldThrowException();
|
|
}
|
|
|
|
#[Test]
|
|
public function shouldReturnValidatorInstanceWhenTheNotRuleIsCalledWithArguments(): void
|
|
{
|
|
$validator = new Validator();
|
|
|
|
self::assertSame($validator, $validator->not($validator->notEmpty()));
|
|
}
|
|
}
|