@@ -3116,6 +3116,44 @@ public function testValidateBoolean()
3116
3116
$ this ->assertTrue ($ v ->passes ());
3117
3117
}
3118
3118
3119
+ public function testValidateBooleanStrict ()
3120
+ {
3121
+ $ trans = $ this ->getIlluminateArrayTranslator ();
3122
+
3123
+ $ v = new Validator ($ trans , ['foo ' => false ], ['foo ' => 'Boolean:strict ' ]);
3124
+ $ this ->assertTrue ($ v ->passes ());
3125
+
3126
+ $ v = new Validator ($ trans , ['foo ' => true ], ['foo ' => 'Boolean:strict ' ]);
3127
+ $ this ->assertTrue ($ v ->passes ());
3128
+
3129
+ $ v = new Validator ($ trans , ['foo ' => 'no ' ], ['foo ' => 'Boolean:strict ' ]);
3130
+ $ this ->assertFalse ($ v ->passes ());
3131
+
3132
+ $ v = new Validator ($ trans , ['foo ' => 'yes ' ], ['foo ' => 'Boolean:strict ' ]);
3133
+ $ this ->assertFalse ($ v ->passes ());
3134
+
3135
+ $ v = new Validator ($ trans , ['foo ' => 'false ' ], ['foo ' => 'Boolean:strict ' ]);
3136
+ $ this ->assertFalse ($ v ->passes ());
3137
+
3138
+ $ v = new Validator ($ trans , ['foo ' => 'true ' ], ['foo ' => 'Boolean:strict ' ]);
3139
+ $ this ->assertFalse ($ v ->passes ());
3140
+
3141
+ $ v = new Validator ($ trans , [], ['foo ' => 'Boolean:strict ' ]);
3142
+ $ this ->assertTrue ($ v ->passes ());
3143
+
3144
+ $ v = new Validator ($ trans , ['foo ' => '1 ' ], ['foo ' => 'Boolean:strict ' ]);
3145
+ $ this ->assertFalse ($ v ->passes ());
3146
+
3147
+ $ v = new Validator ($ trans , ['foo ' => 1 ], ['foo ' => 'Boolean:strict ' ]);
3148
+ $ this ->assertFalse ($ v ->passes ());
3149
+
3150
+ $ v = new Validator ($ trans , ['foo ' => '0 ' ], ['foo ' => 'Boolean:strict ' ]);
3151
+ $ this ->assertFalse ($ v ->passes ());
3152
+
3153
+ $ v = new Validator ($ trans , ['foo ' => 0 ], ['foo ' => 'Boolean:strict ' ]);
3154
+ $ this ->assertFalse ($ v ->passes ());
3155
+ }
3156
+
3119
3157
public function testValidateBool ()
3120
3158
{
3121
3159
$ trans = $ this ->getIlluminateArrayTranslator ();
@@ -3153,6 +3191,44 @@ public function testValidateBool()
3153
3191
$ this ->assertTrue ($ v ->passes ());
3154
3192
}
3155
3193
3194
+ public function testValidateBoolStrict ()
3195
+ {
3196
+ $ trans = $ this ->getIlluminateArrayTranslator ();
3197
+
3198
+ $ v = new Validator ($ trans , ['foo ' => false ], ['foo ' => 'Bool:strict ' ]);
3199
+ $ this ->assertTrue ($ v ->passes ());
3200
+
3201
+ $ v = new Validator ($ trans , ['foo ' => true ], ['foo ' => 'Bool:strict ' ]);
3202
+ $ this ->assertTrue ($ v ->passes ());
3203
+
3204
+ $ v = new Validator ($ trans , ['foo ' => 'no ' ], ['foo ' => 'Bool:strict ' ]);
3205
+ $ this ->assertFalse ($ v ->passes ());
3206
+
3207
+ $ v = new Validator ($ trans , ['foo ' => 'yes ' ], ['foo ' => 'Bool ' ]);
3208
+ $ this ->assertFalse ($ v ->passes ());
3209
+
3210
+ $ v = new Validator ($ trans , ['foo ' => 'false ' ], ['foo ' => 'Bool:strict ' ]);
3211
+ $ this ->assertFalse ($ v ->passes ());
3212
+
3213
+ $ v = new Validator ($ trans , ['foo ' => 'true ' ], ['foo ' => 'Bool:strict ' ]);
3214
+ $ this ->assertFalse ($ v ->passes ());
3215
+
3216
+ $ v = new Validator ($ trans , [], ['foo ' => 'Bool:strict ' ]);
3217
+ $ this ->assertTrue ($ v ->passes ());
3218
+
3219
+ $ v = new Validator ($ trans , ['foo ' => '1 ' ], ['foo ' => 'Bool:strict ' ]);
3220
+ $ this ->assertFalse ($ v ->passes ());
3221
+
3222
+ $ v = new Validator ($ trans , ['foo ' => 1 ], ['foo ' => 'Bool:strict ' ]);
3223
+ $ this ->assertFalse ($ v ->passes ());
3224
+
3225
+ $ v = new Validator ($ trans , ['foo ' => '0 ' ], ['foo ' => 'Bool:strict ' ]);
3226
+ $ this ->assertFalse ($ v ->passes ());
3227
+
3228
+ $ v = new Validator ($ trans , ['foo ' => 0 ], ['foo ' => 'Bool:strict ' ]);
3229
+ $ this ->assertFalse ($ v ->passes ());
3230
+ }
3231
+
3156
3232
public function testValidateNumeric ()
3157
3233
{
3158
3234
$ trans = $ this ->getIlluminateArrayTranslator ();
0 commit comments