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