File tree Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Expand file tree Collapse file tree 4 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 1010 matrix :
1111 os : [ubuntu-latest]
1212 php : [7.3, 7.4, 8.0, 8.1]
13- laravel : [6.*, 7.*, 8.*]
13+ laravel : [6.*, 7.*, 8.*, 9.* ]
1414 dependency-version : [prefer-lowest, prefer-stable]
1515 include :
1616 - laravel : 6.*
1919 testbench : 5.*
2020 - laravel : 8.*
2121 testbench : 6.*
22+ - laravel : 9.*
23+ testbench : 7.*
2224 exclude :
2325 - php : 8.1
2426 laravel : 6.*
2729 - php : 8.1
2830 laravel : 8.*
2931 dependency-version : prefer-lowest
32+ - php : 7.3
33+ laravel : 9.*
34+ - php : 7.4
35+ laravel : 9.*
3036
3137 name : P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}
3238
Original file line number Diff line number Diff line change 1818 ],
1919 "require" : {
2020 "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 "
2323 },
2424 "require-dev" : {
25- "orchestra/testbench" : " ^4.5|^5.0|^6.0" ,
25+ "orchestra/testbench" : " ^4.5|^5.0|^6.0|^7.0 " ,
2626 "phpunit/phpunit" : " ^9.4"
2727 },
2828 "autoload" : {
Original file line number Diff line number Diff line change 33namespace Wilsenhc \RifValidation \Rules ;
44
55use Illuminate \Contracts \Validation \Rule ;
6+ use Illuminate \Support \Str ;
67
78class Rif implements Rule
89{
@@ -40,6 +41,8 @@ public function passes($attribute, $value): bool
4041 {
4142 $ this ->attribute = $ attribute ;
4243
44+ $ value = Str::upper ($ value );
45+
4346 // Verificar si el RIF tiene el formato valido
4447 if (!preg_match ('/^[VEPJGC]-?[\d]{8}-?[\d]$/i ' , $ value ))
4548 {
Original file line number Diff line number Diff line change @@ -73,4 +73,23 @@ public function it_will_return_false_if_format_is_invalid()
7373
7474 $ this ->assertFalse ($ this ->rule ->passes ('rif ' , $ rif ));
7575 }
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+ }
7695}
You can’t perform that action at this time.
0 commit comments