File tree 4 files changed +32
-4
lines changed
4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 10
10
matrix :
11
11
os : [ubuntu-latest]
12
12
php : [7.3, 7.4, 8.0, 8.1]
13
- laravel : [6.*, 7.*, 8.*]
13
+ laravel : [6.*, 7.*, 8.*, 9.* ]
14
14
dependency-version : [prefer-lowest, prefer-stable]
15
15
include :
16
16
- laravel : 6.*
19
19
testbench : 5.*
20
20
- laravel : 8.*
21
21
testbench : 6.*
22
+ - laravel : 9.*
23
+ testbench : 7.*
22
24
exclude :
23
25
- php : 8.1
24
26
laravel : 6.*
27
29
- php : 8.1
28
30
laravel : 8.*
29
31
dependency-version : prefer-lowest
32
+ - php : 7.3
33
+ laravel : 9.*
34
+ - php : 7.4
35
+ laravel : 9.*
30
36
31
37
name : P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
32
38
Original file line number Diff line number Diff line change 18
18
],
19
19
"require" : {
20
20
"php" : " ^7.3|^8.0" ,
21
- "illuminate/support" : " ^6.0|^7.0|^8.0" ,
22
- "illuminate/contracts" : " ^6.0|^7.0|^8.0"
21
+ "illuminate/support" : " ^6.0|^7.0|^8.0|^9.0 " ,
22
+ "illuminate/contracts" : " ^6.0|^7.0|^8.0|^9.0 "
23
23
},
24
24
"require-dev" : {
25
- "orchestra/testbench" : " ^4.5|^5.0|^6.0" ,
25
+ "orchestra/testbench" : " ^4.5|^5.0|^6.0|^7.0 " ,
26
26
"phpunit/phpunit" : " ^9.4"
27
27
},
28
28
"autoload" : {
Original file line number Diff line number Diff line change 3
3
namespace Wilsenhc \RifValidation \Rules ;
4
4
5
5
use Illuminate \Contracts \Validation \Rule ;
6
+ use Illuminate \Support \Str ;
6
7
7
8
class Rif implements Rule
8
9
{
@@ -40,6 +41,8 @@ public function passes($attribute, $value): bool
40
41
{
41
42
$ this ->attribute = $ attribute ;
42
43
44
+ $ value = Str::upper ($ value );
45
+
43
46
// Verificar si el RIF tiene el formato valido
44
47
if (!preg_match ('/^[VEPJGC]-?[\d]{8}-?[\d]$/i ' , $ value ))
45
48
{
Original file line number Diff line number Diff line change @@ -73,4 +73,23 @@ public function it_will_return_false_if_format_is_invalid()
73
73
74
74
$ this ->assertFalse ($ this ->rule ->passes ('rif ' , $ rif ));
75
75
}
76
+
77
+ /** @test */
78
+ public function it_will_convert_values_to_uppercase_before_testing ()
79
+ {
80
+ // Valid RIF of "Universidad de Carabobo"
81
+ $ rif = 'g-20000041-4 ' ;
82
+
83
+ $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
84
+
85
+ // Valid RIF of "Banesco Banco Universal"
86
+ $ rif = 'j-07013380-5 ' ;
87
+
88
+ $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
89
+
90
+ // Valid RIF of "Nicolas Maduro Moros"
91
+ $ rif = 'v-05892464-0 ' ;
92
+
93
+ $ this ->assertTrue ($ this ->rule ->passes ('rif ' , $ rif ));
94
+ }
76
95
}
You can’t perform that action at this time.
0 commit comments