3
3
namespace Illuminate \Tests \Validation ;
4
4
5
5
use Illuminate \Container \Container ;
6
+ use Illuminate \Contracts \Support \Arrayable ;
7
+ use Illuminate \Database \Eloquent \Casts \ArrayObject ;
8
+ use Illuminate \Support \Collection ;
6
9
use Illuminate \Support \Facades \Facade ;
7
10
use Illuminate \Translation \ArrayLoader ;
8
11
use Illuminate \Translation \Translator ;
@@ -101,7 +104,7 @@ public function testValidationPassesForAllCasesUntilEitherOnlyOrExceptIsPassed()
101
104
#[DataProvider('conditionalCasesDataProvider ' )]
102
105
public function testValidationPassesWhenOnlyCasesProvided (
103
106
IntegerStatus |int $ enum ,
104
- array |IntegerStatus $ only ,
107
+ array |Arrayable | IntegerStatus $ only ,
105
108
bool $ expected
106
109
) {
107
110
$ v = new Validator (
@@ -120,7 +123,7 @@ public function testValidationPassesWhenOnlyCasesProvided(
120
123
#[DataProvider('conditionalCasesDataProvider ' )]
121
124
public function testValidationPassesWhenExceptCasesProvided (
122
125
int |IntegerStatus $ enum ,
123
- array |IntegerStatus $ except ,
126
+ array |Arrayable | IntegerStatus $ except ,
124
127
bool $ expected
125
128
) {
126
129
$ v = new Validator (
@@ -251,6 +254,8 @@ public static function conditionalCasesDataProvider(): array
251
254
return [
252
255
[IntegerStatus::done, IntegerStatus::done, true ],
253
256
[IntegerStatus::done, [IntegerStatus::done, IntegerStatus::pending], true ],
257
+ [IntegerStatus::done, new ArrayObject ([IntegerStatus::done, IntegerStatus::pending]), true ],
258
+ [IntegerStatus::done, new Collection ([IntegerStatus::done, IntegerStatus::pending]), true ],
254
259
[IntegerStatus::pending->value , [IntegerStatus::done, IntegerStatus::pending], true ],
255
260
[IntegerStatus::done->value , IntegerStatus::pending, false ],
256
261
];
0 commit comments