@@ -168,6 +168,156 @@ public function forColumn_return_json_rule_for_the_json_type()
168
168
$ this ->assertContains ('json ' , Rules::fromColumn ('context ' , $ column ));
169
169
}
170
170
171
+ /**
172
+ * @test
173
+ */
174
+ public function forColumn_does_not_return_between_rule_for_decimal_without_precion_and_scale ()
175
+ {
176
+ $ column = new Column ('column ' , "decimal " );
177
+
178
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ column ));
179
+ }
180
+
181
+ /**
182
+ * @test
183
+ */
184
+ public function forColumn_does_not_return_between_rule_for_unsigned_decimal_without_precion_and_scale ()
185
+ {
186
+ $ unsignedBeforeDecimalColumn = new Column ('column ' , "unsigned decimal " );
187
+
188
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ unsignedBeforeDecimalColumn ));
189
+
190
+ $ unsignedAfterDecimalColumn = new Column ('column ' , "decimal unsigned " );
191
+
192
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ unsignedAfterDecimalColumn ));
193
+ }
194
+
195
+ /**
196
+ * @test
197
+ * @dataProvider numericDataProvider
198
+ */
199
+ public function forColumn_return_between_rule_for_decimal ($ precision , $ scale , $ interval )
200
+ {
201
+ $ column = new Column ('column ' , "decimal: $ precision, $ scale " );
202
+
203
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ column ));
204
+ }
205
+
206
+ /**
207
+ * @test
208
+ * @dataProvider unsignedNumericDataProvider
209
+ */
210
+ public function forColumn_return_between_rule_for_unsigned_decimal ($ precision , $ scale , $ interval )
211
+ {
212
+ $ unsignedBeforeDecimalColumn = new Column ('column ' , "unsigned decimal: $ precision, $ scale " );
213
+
214
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ unsignedBeforeDecimalColumn ));
215
+
216
+ $ unsignedAfterDecimalColumn = new Column ('column ' , "decimal: $ precision, $ scale unsigned " );
217
+
218
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ unsignedAfterDecimalColumn ));
219
+ }
220
+
221
+ /**
222
+ * @test
223
+ */
224
+ public function forColumn_does_not_return_between_rule_for_float_without_precion_and_scale ()
225
+ {
226
+ $ column = new Column ('column ' , "float " );
227
+
228
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ column ));
229
+ }
230
+
231
+ /**
232
+ * @test
233
+ */
234
+ public function forColumn_does_not_return_between_rule_for_unsigned_float_without_precion_and_scale ()
235
+ {
236
+ $ unsignedBeforeFloatColumn = new Column ('column ' , "unsigned float " );
237
+
238
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ unsignedBeforeFloatColumn ));
239
+
240
+ $ unsignedAfterFloatColumn = new Column ('column ' , "float unsigned " );
241
+
242
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ unsignedAfterFloatColumn ));
243
+ }
244
+
245
+ /**
246
+ * @test
247
+ * @dataProvider numericDataProvider
248
+ */
249
+ public function forColumn_return_between_rule_for_float ($ precision , $ scale , $ interval )
250
+ {
251
+ $ column = new Column ('column ' , "float: $ precision, $ scale " );
252
+
253
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ column ));
254
+ }
255
+
256
+ /**
257
+ * @test
258
+ * @dataProvider unsignedNumericDataProvider
259
+ */
260
+ public function forColumn_return_between_rule_for_unsigned_float ($ precision , $ scale , $ interval )
261
+ {
262
+ $ unsignedBeforeFloatColumn = new Column ('column ' , "unsigned float: $ precision, $ scale " );
263
+
264
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ unsignedBeforeFloatColumn ));
265
+
266
+ $ unsignedAfterFloatColumn = new Column ('column ' , "float: $ precision, $ scale unsigned " );
267
+
268
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ unsignedAfterFloatColumn ));
269
+ }
270
+
271
+ /**
272
+ * @test
273
+ */
274
+ public function forColumn_does_not_return_between_rule_for_double_without_precion_and_scale ()
275
+ {
276
+ $ column = new Column ('column ' , "double " );
277
+
278
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ column ));
279
+ }
280
+
281
+ /**
282
+ * @test
283
+ */
284
+ public function forColumn_does_not_return_between_rule_for_unsigned_double_without_precion_and_scale ()
285
+ {
286
+ $ unsignedBeforeDoubleColumn = new Column ('column ' , "unsigned double " );
287
+
288
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ unsignedBeforeDoubleColumn ));
289
+
290
+ $ unsignedAfterDoubleColumn = new Column ('column ' , "double unsigned " );
291
+
292
+ $ this ->assertNotContains ("between " , Rules::fromColumn ('context ' , $ unsignedAfterDoubleColumn ));
293
+ }
294
+
295
+ /**
296
+ * @test
297
+ * @dataProvider numericDataProvider
298
+ */
299
+ public function forColumn_return_between_rule_for_double ($ precision , $ scale , $ interval )
300
+ {
301
+ $ column = new Column ('column ' , "double: $ precision, $ scale " );
302
+
303
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ column ));
304
+ }
305
+
306
+ /**
307
+ * @test
308
+ * @dataProvider unsignedNumericDataProvider
309
+ */
310
+ public function forColumn_return_between_rule_for_unsigned_double ($ precision , $ scale , $ interval )
311
+ {
312
+ $ unsignedBeforeDoubleColumn = new Column ('column ' , "unsigned double: $ precision, $ scale " );
313
+
314
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ unsignedBeforeDoubleColumn ));
315
+
316
+ $ unsignedAfterDoubleColumn = new Column ('column ' , "double: $ precision, $ scale unsigned " );
317
+
318
+ $ this ->assertContains ("between: $ interval " , Rules::fromColumn ('context ' , $ unsignedAfterDoubleColumn ));
319
+ }
320
+
171
321
public function stringDataTypesProvider ()
172
322
{
173
323
return [
@@ -225,4 +375,36 @@ public function relationshipColumnProvider()
225
375
['sheep_id ' , 'sheep ' ],
226
376
];
227
377
}
378
+
379
+ public function numericDataProvider ()
380
+ {
381
+ return [
382
+ ['10 ' , '0 ' , '-9999999999,9999999999 ' ],
383
+ ['10 ' , '1 ' , '-999999999.9,999999999.9 ' ],
384
+ ['10 ' , '2 ' , '-99999999.99,99999999.99 ' ],
385
+ ['10 ' , '3 ' , '-9999999.999,9999999.999 ' ],
386
+ ['10 ' , '4 ' , '-999999.9999,999999.9999 ' ],
387
+ ['10 ' , '5 ' , '-99999.99999,99999.99999 ' ],
388
+ ['10 ' , '6 ' , '-9999.999999,9999.999999 ' ],
389
+ ['10 ' , '7 ' , '-999.9999999,999.9999999 ' ],
390
+ ['10 ' , '8 ' , '-99.99999999,99.99999999 ' ],
391
+ ['10 ' , '9 ' , '-9.999999999,9.999999999 ' ],
392
+ ];
393
+ }
394
+
395
+ public function unsignedNumericDataProvider ()
396
+ {
397
+ return [
398
+ ['10 ' , '0 ' , '0,9999999999 ' ],
399
+ ['10 ' , '1 ' , '0,999999999.9 ' ],
400
+ ['10 ' , '2 ' , '0,99999999.99 ' ],
401
+ ['10 ' , '3 ' , '0,9999999.999 ' ],
402
+ ['10 ' , '4 ' , '0,999999.9999 ' ],
403
+ ['10 ' , '5 ' , '0,99999.99999 ' ],
404
+ ['10 ' , '6 ' , '0,9999.999999 ' ],
405
+ ['10 ' , '7 ' , '0,999.9999999 ' ],
406
+ ['10 ' , '8 ' , '0,99.99999999 ' ],
407
+ ['10 ' , '9 ' , '0,9.999999999 ' ],
408
+ ];
409
+ }
228
410
}
0 commit comments