@@ -38,109 +38,104 @@ protected function getPackageProviders($app)
38
38
];
39
39
}
40
40
41
- /** @test */
42
- public function it_will_return_true_if_rif_is_valid ()
41
+ public function testItWillReturnVoidIfRifIsValid ()
43
42
{
44
43
// Valid RIF of "Universidad de Carabobo"
45
44
$ rif = 'G-20000041-4 ' ;
46
45
47
- $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
46
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn () => null ));
48
47
49
48
// Valid RIF of "Banesco Banco Universal"
50
49
$ rif = 'J-07013380-5 ' ;
51
50
52
- $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
51
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn () => null ));
53
52
54
53
// Valid RIF of "Nicolas Maduro Moros"
55
54
$ rif = 'V-05892464-0 ' ;
56
55
57
- $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
56
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn () => null ));
58
57
}
59
58
60
- /** @test */
61
- public function it_will_return_false_if_format_is_invalid ()
59
+ public function testItWillReturnFalseIfFormatIsInvalid ()
62
60
{
63
61
// Starts with a RIF Type that doesn't exist
64
62
$ rif = 'Q-00000000-0 ' ;
65
63
66
- $ this ->assertFalse ($ this ->rule ->passes ('rif ' , $ rif ));
64
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn ( $ value ) => $ this -> assertNotNull ( $ value ) ));
67
65
68
66
// Extra number
69
67
$ rif = 'G-200000041-4 ' ;
70
68
71
- $ this ->assertFalse ($ this ->rule ->passes ('rif ' , $ rif ));
69
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn ( $ value ) => $ this -> assertNotNull ( $ value ) ));
72
70
73
71
// Missing numbers
74
72
$ rif = 'V-5892464 ' ;
75
73
76
- $ this ->assertFalse ($ this ->rule ->passes ('rif ' , $ rif ));
74
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn ( $ value ) => $ this -> assertNotNull ( $ value ) ));
77
75
78
76
// Letter where there should be only numbers
79
77
$ rif = 'G-200F00041-F ' ;
80
78
81
- $ this ->assertFalse ($ this ->rule ->passes ('rif ' , $ rif ));
79
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn ( $ value ) => $ this -> assertNotNull ( $ value ) ));
82
80
}
83
81
84
- /** @test */
85
- public function it_will_convert_values_to_uppercase_before_testing ()
82
+ public function testItWillConvertValuesToUppercaseBeforeTesting ()
86
83
{
87
84
// Valid RIF of "Universidad de Carabobo"
88
85
$ rif = 'g-20000041-4 ' ;
89
86
90
- $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
87
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn () => null ));
91
88
92
89
// Valid RIF of "Banesco Banco Universal"
93
90
$ rif = 'j-07013380-5 ' ;
94
91
95
- $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
92
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn () => null ));
96
93
97
94
// Valid RIF of "Nicolas Maduro Moros"
98
95
$ rif = 'v-05892464-0 ' ;
99
96
100
- $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
97
+ $ this ->assertNull ($ this ->rule ->validate ('rif ' , $ rif, fn () => null ));
101
98
}
102
99
103
- /** @test */
104
- public function it_will_validate_using_class ()
100
+ public function testItWillValidateUsingClass ()
105
101
{
106
102
// Valid RIF of "Universidad de Carabobo"
107
- $ this ->assertTrue ( $ this ->validator ->make (
103
+ $ this ->assertEquals ([ ' rif ' => ' G-20000041-4 ' ], $ this ->validator ->make (
108
104
['rif ' => 'G-20000041-4 ' ],
109
105
['rif ' => new Rif ],
110
- )->passes ());
106
+ )->validate ());
111
107
112
108
// Valid RIF of "Banesco Banco Universal"
113
- $ this ->assertTrue ( $ this ->validator ->make (
109
+ $ this ->assertEquals ([ ' rif ' => ' J-07013380-5 ' ], $ this ->validator ->make (
114
110
['rif ' => 'J-07013380-5 ' ],
115
111
['rif ' => new Rif ],
116
- )->passes ());
112
+ )->validate ());
117
113
118
114
// Valid RIF of "Nicolas Maduro Moros"
119
- $ this ->assertTrue ( $ this ->validator ->make (
115
+ $ this ->assertEquals ([ ' rif ' => ' V-05892464-0 ' ], $ this ->validator ->make (
120
116
['rif ' => 'V-05892464-0 ' ],
121
117
['rif ' => new Rif ],
122
- )->passes ());
118
+ )->validate ());
123
119
}
124
120
125
- /** @test */
126
- public function it_will_validate_using_shortname ()
121
+ public function testItWillValidateUsingShortname ()
127
122
{
128
123
// Valid RIF of "Universidad de Carabobo"
129
- $ this ->assertTrue ( $ this ->validator ->make (
124
+ $ this ->assertEquals ([ ' rif ' => ' G-20000041-4 ' ], $ this ->validator ->make (
130
125
['rif ' => 'G-20000041-4 ' ],
131
126
['rif ' => 'rif ' ],
132
- )->passes ());
127
+ )->validate ());
133
128
134
129
// Valid RIF of "Banesco Banco Universal"
135
- $ this ->assertTrue ( $ this ->validator ->make (
130
+ $ this ->assertEquals ([ ' rif ' => ' J-07013380-5 ' ], $ this ->validator ->make (
136
131
['rif ' => 'J-07013380-5 ' ],
137
132
['rif ' => 'rif ' ],
138
- )->passes ());
133
+ )->validate ());
139
134
140
135
// Valid RIF of "Nicolas Maduro Moros"
141
- $ this ->assertTrue ( $ this ->validator ->make (
136
+ $ this ->assertEquals ([ ' rif ' => ' V-05892464-0 ' ], $ this ->validator ->make (
142
137
['rif ' => 'V-05892464-0 ' ],
143
138
['rif ' => 'rif ' ],
144
- )->passes ());
139
+ )->validate ());
145
140
}
146
- }
141
+ }
0 commit comments