@@ -40,12 +40,10 @@ public function testConstraintThatDoesNotExist(): void
4040
4141 public function testValidate (): void
4242 {
43- // test fail
4443 $ violations = $ this ->validator ->validate (16 );
4544 $ this ->assertInstanceOf (ConstraintViolationList::class, $ violations );
4645 $ this ->assertCount (1 , $ violations );
4746
48- // test success
4947 $ violations = $ this ->validator ->validate (18 );
5048 $ this ->assertInstanceOf (ConstraintViolationList::class, $ violations );
5149 $ this ->assertCount (0 , $ violations );
@@ -65,9 +63,7 @@ public function testAssertSuccess(): void
6563
6664 public function testIsValid (): void
6765 {
68- // test fail
6966 $ this ->assertFalse ($ this ->validator ->isValid (16 ));
70- // test success
7167 $ this ->assertTrue ($ this ->validator ->isValid (18 ));
7268 }
7369
@@ -84,22 +80,20 @@ public function testCustomConstraint(): void
8480 {
8581 Validator::addNamespace ('ProgrammatorDev\FluentValidator\Test\Constraint ' );
8682
87- // test fail
8883 $ this ->assertFalse (Validator::containsAlphanumeric ()->isValid ('! ' ));
89- // test success
9084 $ this ->assertTrue (Validator::containsAlphanumeric ()->isValid ('v4l1d ' ));
9185 }
9286
9387 public function testSetTranslator (): void
9488 {
9589 // by default, error is in English
9690 $ violations = $ this ->validator ->validate ('' );
97- $ this ->assertEquals ('This value should not be blank. ' , $ violations[ 0 ] ->getMessage ());
91+ $ this ->assertEquals ('This value should not be blank. ' , $ violations-> get ( 0 ) ->getMessage ());
9892
9993 // set translator and then try again
10094 Validator::setTranslator (new Translator ('pt ' ));
10195 // now error is in Portuguese
10296 $ violations = $ this ->validator ->validate ('' );
103- $ this ->assertEquals ('Este valor não deveria ser vazio. ' , $ violations[ 0 ] ->getMessage ());
97+ $ this ->assertEquals ('Este valor não deveria ser vazio. ' , $ violations-> get ( 0 ) ->getMessage ());
10498 }
10599}
0 commit comments