* * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ declare(strict_types=1); namespace Respect\Validation; use Respect\Validation\Exceptions\ComponentException; use Respect\Validation\Test\TestCase; /** * @covers \Respect\Validation\Validator * * @author Alexandre Gomes Gaigalas * @author Gabriel Caruso * @author Henrique Moody * @author Nick Lombard */ 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(); } /** * Regression test #174. * * @test */ public function shouldReturnValidatorInstanceWhenTheNotRuleIsCalledWithArguments(): void { $validator = new Validator(); self::assertSame($validator, $validator->not($validator->notEmpty())); } }