@@ -1156,6 +1156,10 @@ public function testRequiredUnless()
1156
1156
$ v = new Validator ($ trans , ['first ' => 'sven ' ], ['last ' => 'required_unless:first,taylor,sven ' ]);
1157
1157
$ this ->assertTrue ($ v ->passes ());
1158
1158
1159
+ $ trans = $ this ->getIlluminateArrayTranslator ();
1160
+ $ v = new Validator ($ trans , [], ['bar ' => 'required_unless:foo,true ' ]);
1161
+ $ this ->assertTrue ($ v ->fails ());
1162
+
1159
1163
$ trans = $ this ->getIlluminateArrayTranslator ();
1160
1164
$ v = new Validator ($ trans , ['foo ' => false ], ['bar ' => 'required_unless:foo,false ' ]);
1161
1165
$ this ->assertTrue ($ v ->passes ());
@@ -1164,6 +1168,18 @@ public function testRequiredUnless()
1164
1168
$ v = new Validator ($ trans , ['foo ' => false ], ['bar ' => 'required_unless:foo,true ' ]);
1165
1169
$ this ->assertTrue ($ v ->fails ());
1166
1170
1171
+ $ trans = $ this ->getIlluminateArrayTranslator ();
1172
+ $ v = new Validator ($ trans , ['bar ' => '1 ' ], ['bar ' => 'required_unless:foo,true ' ]);
1173
+ $ this ->assertTrue ($ v ->passes ());
1174
+
1175
+ $ trans = $ this ->getIlluminateArrayTranslator ();
1176
+ $ v = new Validator ($ trans , [], ['bar ' => 'required_unless:foo,true ' ]);
1177
+ $ this ->assertTrue ($ v ->fails ());
1178
+
1179
+ $ trans = $ this ->getIlluminateArrayTranslator ();
1180
+ $ v = new Validator ($ trans , [], ['bar ' => 'required_unless:foo,null ' ]);
1181
+ $ this ->assertTrue ($ v ->passes ());
1182
+
1167
1183
$ trans = $ this ->getIlluminateArrayTranslator ();
1168
1184
$ v = new Validator ($ trans , ['foo ' => true ], ['bar ' => 'required_unless:foo,null ' ]);
1169
1185
$ this ->assertTrue ($ v ->fails ());
@@ -5524,6 +5540,16 @@ public function testExcludeUnless()
5524
5540
);
5525
5541
$ this ->assertTrue ($ validator ->passes ());
5526
5542
$ this ->assertSame (['foo ' => true ], $ validator ->validated ());
5543
+
5544
+ $ trans = $ this ->getIlluminateArrayTranslator ();
5545
+ $ v = new Validator ($ trans , ['bar ' => 'Hello ' ], ['bar ' => 'exclude_unless:foo,true ' ]);
5546
+ $ this ->assertTrue ($ v ->passes ());
5547
+ $ this ->assertSame ([], $ v ->validated ());
5548
+
5549
+ $ trans = $ this ->getIlluminateArrayTranslator ();
5550
+ $ v = new Validator ($ trans , ['bar ' => 'Hello ' ], ['bar ' => 'exclude_unless:foo,null ' ]);
5551
+ $ this ->assertTrue ($ v ->passes ());
5552
+ $ this ->assertSame (['bar ' => 'Hello ' ], $ v ->validated ());
5527
5553
}
5528
5554
5529
5555
public function testExcludeValuesAreReallyRemoved ()
0 commit comments