@@ -49,6 +49,14 @@ public function testValidate(): void
4949 $ this ->assertCount (0 , $ violations );
5050 }
5151
52+ public function testValidateWithoutConstraints (): void
53+ {
54+ $ violations = (new Validator ())->validate ('anything ' );
55+
56+ $ this ->assertInstanceOf (ConstraintViolationList::class, $ violations );
57+ $ this ->assertCount (0 , $ violations );
58+ }
59+
5260 public function testAssertFail (): void
5361 {
5462 $ this ->expectException (ValidationFailedException::class);
@@ -67,6 +75,11 @@ public function testIsValid(): void
6775 $ this ->assertTrue ($ this ->validator ->isValid (18 ));
6876 }
6977
78+ public function testIsValidWithoutConstraints (): void
79+ {
80+ $ this ->assertTrue ((new Validator ())->isValid ('anything ' ));
81+ }
82+
7083 public function testToArray (): void
7184 {
7285 $ constraints = $ this ->validator ->toArray ();
@@ -76,6 +89,11 @@ public function testToArray(): void
7689 $ this ->assertInstanceOf (LessThan::class, $ constraints [2 ]);
7790 }
7891
92+ public function testToArrayWithoutConstraints (): void
93+ {
94+ $ this ->assertSame ([], (new Validator ())->toArray ());
95+ }
96+
7997 public function testCustomConstraint (): void
8098 {
8199 Validator::addNamespace ('ProgrammatorDev\FluentValidator\Test\Fixtures\Constraint ' );
0 commit comments