respect-validation/tests/unit/ValidatorTest.php
Henrique Moody c946f16f60
Move mixin classes to the "Mixin" namespace
Just to make the root directory cleaner.

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

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