@@ -72,6 +72,33 @@ public function forColumn_overrides_string_rule_with_password_rule_for_attribute
72
72
$ this ->assertNotContains ('string ' , Rules::fromColumn ($ column ));
73
73
}
74
74
75
+ /**
76
+ * @test
77
+ * @dataProvider numericDataTypesProvider
78
+ */
79
+ public function forColumn_returns_numeric_rule_for_numeric_types ($ data_type )
80
+ {
81
+ $ column = new Column ('test ' , $ data_type );
82
+
83
+ $ this ->assertContains ('numeric ' , Rules::fromColumn ($ column ));
84
+ }
85
+
86
+ /**
87
+ * @test
88
+ */
89
+ public function forColumn_returns_gt0_rule_for_unsigned_numeric_types ()
90
+ {
91
+ $ column = new Column ('test ' , 'integer ' );
92
+
93
+ $ this ->assertContains ('numeric ' , Rules::fromColumn ($ column ));
94
+ $ this ->assertNotContains ('gt:0 ' , Rules::fromColumn ($ column ));
95
+
96
+ $ column = new Column ('test ' , 'unsignedInteger ' );
97
+
98
+ $ this ->assertContains ('gt:0 ' , Rules::fromColumn ($ column ));
99
+ $ this ->assertContains ('numeric ' , Rules::fromColumn ($ column ));
100
+ }
101
+
75
102
public function stringDataTypesProvider ()
76
103
{
77
104
return [
@@ -80,4 +107,29 @@ public function stringDataTypesProvider()
80
107
['text ' ]
81
108
];
82
109
}
110
+
111
+ public function numericDataTypesProvider ()
112
+ {
113
+ return [
114
+ ['integer ' ],
115
+ ['tinyInteger ' ],
116
+ ['smallInteger ' ],
117
+ ['mediumInteger ' ],
118
+ ['bigInteger ' ],
119
+ ['decimal ' ],
120
+ ['double ' ],
121
+ ['float ' ],
122
+ ['increments ' ],
123
+ ['tinyIncrements ' ],
124
+ ['smallIncrements ' ],
125
+ ['mediumIncrements ' ],
126
+ ['bigIncrements ' ],
127
+ ['unsignedBigInteger ' ],
128
+ ['unsignedDecimal ' ],
129
+ ['unsignedInteger ' ],
130
+ ['unsignedMediumInteger ' ],
131
+ ['unsignedSmallInteger ' ],
132
+ ['unsignedTinyInteger ' ],
133
+ ];
134
+ }
83
135
}
0 commit comments