This repository was archived by the owner on Feb 14, 2023. It is now read-only.
File tree 6 files changed +21
-15
lines changed
Laravel/Parsers/Validation
6 files changed +21
-15
lines changed Original file line number Diff line number Diff line change 32
32
"symfony/http-foundation" : " ^4.0 || ^5.0 || ^6.0"
33
33
},
34
34
"require-dev" : {
35
+ "dragon-code/laravel-support" : " ^3.3" ,
35
36
"orchestra/testbench" : " ^4.0 || ^5.0 || ^6.0 || ^7.0"
36
37
},
37
38
"conflict" : {
Original file line number Diff line number Diff line change 17
17
18
18
namespace Tests \Fixtures \Concerns ;
19
19
20
+ use DragonCode \LaravelSupport \Facades \AppVersion ;
20
21
use Illuminate \Contracts \Validation \Validator as ValidatorContract ;
21
22
use Illuminate \Support \Facades \Validator ;
22
23
use Illuminate \Validation \ValidationException ;
@@ -70,4 +71,9 @@ protected function validateException(array $data)
70
71
? new ValidationException ($ validator )
71
72
: $ validator ->validated ();
72
73
}
74
+
75
+ protected function validationUrlMessage (): array
76
+ {
77
+ return AppVersion::is7x () ? ['The baz format is invalid. ' ] : ['The baz must be a valid URL. ' ];
78
+ }
73
79
}
Original file line number Diff line number Diff line change @@ -57,16 +57,15 @@ public function testStructure()
57
57
$ this ->validationResponse ([])->getJson ()
58
58
);
59
59
60
- $ this ->assertSame (
61
- [
62
- 'error ' => [
63
- 'type ' => 'ValidationException ' ,
64
- 'data ' => [
65
- 'foo ' => ['The foo field is required. ' ],
66
- 'baz ' => ['The baz must be a valid URL. ' ],
67
- ],
60
+ $ this ->assertSame ([
61
+ 'error ' => [
62
+ 'type ' => 'ValidationException ' ,
63
+ 'data ' => [
64
+ 'foo ' => ['The foo field is required. ' ],
65
+ 'baz ' => $ this ->validationUrlMessage (),
68
66
],
69
67
],
68
+ ],
70
69
$ this ->validationResponse (['baz ' => 0 ])->getJson ()
71
70
);
72
71
@@ -77,7 +76,7 @@ public function testStructure()
77
76
'data ' => [
78
77
'foo ' => ['The foo field is required. ' ],
79
78
'bar ' => ['The bar must be an integer. ' ],
80
- 'baz ' => [ ' The baz must be a valid URL. ' ] ,
79
+ 'baz ' => $ this -> validationUrlMessage () ,
81
80
],
82
81
],
83
82
],
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ public function testStructure()
65
65
'type ' => 'ValidationException ' ,
66
66
'data ' => [
67
67
'foo ' => ['The foo field is required. ' ],
68
- 'baz ' => [ ' The baz must be a valid URL. ' ] ,
68
+ 'baz ' => $ this -> validationUrlMessage () ,
69
69
],
70
70
],
71
71
],
@@ -79,7 +79,7 @@ public function testStructure()
79
79
'data ' => [
80
80
'foo ' => ['The foo field is required. ' ],
81
81
'bar ' => ['The bar must be an integer. ' ],
82
- 'baz ' => [ ' The baz must be a valid URL. ' ] ,
82
+ 'baz ' => $ this -> validationUrlMessage () ,
83
83
],
84
84
],
85
85
],
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ public function testStructure()
62
62
'type ' => 'ValidationException ' ,
63
63
'data ' => [
64
64
'foo ' => ['The foo field is required. ' ],
65
- 'baz ' => [ ' The baz must be a valid URL. ' ] ,
65
+ 'baz ' => $ this -> validationUrlMessage () ,
66
66
],
67
67
],
68
68
],
@@ -76,7 +76,7 @@ public function testStructure()
76
76
'data ' => [
77
77
'foo ' => ['The foo field is required. ' ],
78
78
'bar ' => ['The bar must be an integer. ' ],
79
- 'baz ' => [ ' The baz must be a valid URL. ' ] ,
79
+ 'baz ' => $ this -> validationUrlMessage () ,
80
80
],
81
81
],
82
82
],
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public function testStructure()
64
64
'type ' => 'ValidationException ' ,
65
65
'data ' => [
66
66
'foo ' => ['The foo field is required. ' ],
67
- 'baz ' => [ ' The baz must be a valid URL. ' ] ,
67
+ 'baz ' => $ this -> validationUrlMessage () ,
68
68
],
69
69
],
70
70
],
@@ -78,7 +78,7 @@ public function testStructure()
78
78
'data ' => [
79
79
'foo ' => ['The foo field is required. ' ],
80
80
'bar ' => ['The bar must be an integer. ' ],
81
- 'baz ' => [ ' The baz must be a valid URL. ' ] ,
81
+ 'baz ' => $ this -> validationUrlMessage () ,
82
82
],
83
83
],
84
84
],
You can’t perform that action at this time.
0 commit comments