44
55namespace Axlon \PostalCodeValidation \Tests \Integration ;
66
7+ use Illuminate \Support \Facades \Validator ;
78use InvalidArgumentException ;
89
910final class PostalCodeForTest extends TestCase
@@ -15,13 +16,13 @@ final class PostalCodeForTest extends TestCase
1516 */
1617 public function testValidationFailsInvalidCountry (): void
1718 {
18- $ validator = $ this -> app -> make ( ' validator ' )-> make (
19+ $ validator = Validator:: make (
1920 ['postal_code ' => '1234 AB ' , 'country ' => 'not-a-country ' ],
2021 ['postal_code ' => 'postal_code_for:country ' ],
2122 );
2223
23- $ this -> assertFalse ($ validator ->passes ());
24- $ this -> assertContains ('validation.postal_code_for ' , $ validator ->errors ()->all ());
24+ self :: assertFalse ($ validator ->passes ());
25+ self :: assertContains ('validation.postal_code_for ' , $ validator ->errors ()->all ());
2526 }
2627
2728 /**
@@ -31,13 +32,13 @@ public function testValidationFailsInvalidCountry(): void
3132 */
3233 public function testValidationFailsInvalidPostalCode (): void
3334 {
34- $ validator = $ this -> app -> make ( ' validator ' )-> make (
35+ $ validator = Validator:: make (
3536 ['postal_code ' => 'not-a-postal-code ' , 'country ' => 'NL ' ],
3637 ['postal_code ' => 'postal_code_for:country ' ],
3738 );
3839
39- $ this -> assertFalse ($ validator ->passes ());
40- $ this -> assertContains ('validation.postal_code_for ' , $ validator ->errors ()->all ());
40+ self :: assertFalse ($ validator ->passes ());
41+ self :: assertContains ('validation.postal_code_for ' , $ validator ->errors ()->all ());
4142 }
4243
4344 /**
@@ -48,24 +49,24 @@ public function testValidationFailsInvalidPostalCode(): void
4849 */
4950 public function testValidationFailsNullPostalCode (): void
5051 {
51- $ validator = $ this -> app -> make ( ' validator ' )-> make (
52+ $ validator = Validator:: make (
5253 ['postal_code ' => null , 'country ' => 'DE ' ],
5354 ['postal_code ' => 'postal_code_for:country ' ],
5455 );
5556
56- $ this -> assertFalse ($ validator ->passes ());
57- $ this -> assertContains ('validation.postal_code_for ' , $ validator ->errors ()->all ());
57+ self :: assertFalse ($ validator ->passes ());
58+ self :: assertContains ('validation.postal_code_for ' , $ validator ->errors ()->all ());
5859 }
5960
6061 public function testValidationPassesIfAllFieldsAreMissing (): void
6162 {
62- $ validator = $ this -> app -> make ( ' validator ' )-> make (
63+ $ validator = Validator:: make (
6364 ['postal_code ' => '1234 AB ' ],
6465 ['postal_code ' => 'postal_code_for:country ' ],
6566 );
6667
67- $ this -> assertTrue ($ validator ->passes ());
68- $ this -> assertEmpty ($ validator ->errors ()->all ());
68+ self :: assertTrue ($ validator ->passes ());
69+ self :: assertEmpty ($ validator ->errors ()->all ());
6970 }
7071
7172 /**
@@ -75,13 +76,13 @@ public function testValidationPassesIfAllFieldsAreMissing(): void
7576 */
7677 public function testValidationIgnoresMissingFields (): void
7778 {
78- $ validator = $ this -> app -> make ( ' validator ' )-> make (
79+ $ validator = Validator:: make (
7980 ['postal_code ' => '1234 AB ' , 'empty ' => '' , 'null ' => null , 'country ' => 'NL ' ],
8081 ['postal_code ' => 'postal_code_for:empty,missing,null,country ' ],
8182 );
8283
83- $ this -> assertTrue ($ validator ->passes ());
84- $ this -> assertEmpty ($ validator ->errors ()->all ());
84+ self :: assertTrue ($ validator ->passes ());
85+ self :: assertEmpty ($ validator ->errors ()->all ());
8586 }
8687
8788 /**
@@ -91,13 +92,13 @@ public function testValidationIgnoresMissingFields(): void
9192 */
9293 public function testValidationPassesValidPostalCode (): void
9394 {
94- $ validator = $ this -> app -> make ( ' validator ' )-> make (
95+ $ validator = Validator:: make (
9596 ['postal_code ' => '1234 AB ' , 'country ' => 'NL ' ],
9697 ['postal_code ' => 'postal_code_for:country ' ],
9798 );
9899
99- $ this -> assertTrue ($ validator ->passes ());
100- $ this -> assertEmpty ($ validator ->errors ()->all ());
100+ self :: assertTrue ($ validator ->passes ());
101+ self :: assertEmpty ($ validator ->errors ()->all ());
101102 }
102103
103104 /**
@@ -107,7 +108,7 @@ public function testValidationPassesValidPostalCode(): void
107108 */
108109 public function testValidationThrowsWithoutParameters (): void
109110 {
110- $ validator = $ this -> app -> make ( ' validator ' )-> make (
111+ $ validator = Validator:: make (
111112 ['postal_code ' => '1234 AB ' ],
112113 ['postal_code ' => 'postal_code_for ' ],
113114 );
0 commit comments