1 | <?php |
||
10 | final class FloatsTest extends TestCase |
||
11 | { |
||
12 | /** |
||
13 | * @test |
||
14 | * @covers ::filter |
||
15 | * @expectedException \InvalidArgumentException |
||
16 | * @expectedExceptionMessage "1" $allowNull was not a bool |
||
17 | */ |
||
18 | public function filterAllowNullIsNotBool() |
||
22 | |||
23 | /** |
||
24 | * @test |
||
25 | * @covers ::filter |
||
26 | * @expectedException \InvalidArgumentException |
||
27 | * @expectedExceptionMessage "'boo'" $minValue was not a float |
||
28 | */ |
||
29 | public function filterMinValueNotFloat() |
||
33 | |||
34 | /** |
||
35 | * @test |
||
36 | * @covers ::filter |
||
37 | * @expectedException \InvalidArgumentException |
||
38 | * @expectedExceptionMessage "1" $maxValue was not a float |
||
39 | */ |
||
40 | public function filterMaxValueNotFloat() |
||
44 | |||
45 | /** |
||
46 | * @test |
||
47 | * @covers ::filter |
||
48 | */ |
||
49 | public function filterAllowNullIsTrueAndNullValue() |
||
53 | |||
54 | /** |
||
55 | * @test |
||
56 | * @covers ::filter |
||
57 | */ |
||
58 | public function filterPositiveFloat() |
||
62 | |||
63 | /** |
||
64 | * @test |
||
65 | * @covers ::filter |
||
66 | */ |
||
67 | public function filterNegativeFloat() |
||
71 | |||
72 | /** |
||
73 | * @test |
||
74 | * @covers ::filter |
||
75 | */ |
||
76 | public function filterZeroFloat() |
||
82 | |||
83 | /** |
||
84 | * @test |
||
85 | * @covers ::filter |
||
86 | */ |
||
87 | public function filterPositiveString() |
||
102 | |||
103 | /** |
||
104 | * @test |
||
105 | * @covers ::filter |
||
106 | */ |
||
107 | public function filterNegativeString() |
||
120 | |||
121 | /** |
||
122 | * @test |
||
123 | * @covers ::filter |
||
124 | * @expectedException \TraderInteractive\Filter\Exception |
||
125 | * @expectedExceptionMessage "true" $value is not a string |
||
126 | */ |
||
127 | public function filterNonStringOrFloat() |
||
131 | |||
132 | /** |
||
133 | * @test |
||
134 | * @covers ::filter |
||
135 | * @expectedException \TraderInteractive\Filter\Exception |
||
136 | * @exceptedExceptionMessage does not pass is_numeric |
||
137 | */ |
||
138 | public function filterEmptyString() |
||
142 | |||
143 | /** |
||
144 | * @test |
||
145 | * @covers ::filter |
||
146 | * @expectedException \TraderInteractive\Filter\Exception |
||
147 | * @expectedExceptionMessage does not pass is_numeric |
||
148 | */ |
||
149 | public function filterWhitespaceString() |
||
153 | |||
154 | /** |
||
155 | * @test |
||
156 | * @covers ::filter |
||
157 | * @expectedException \TraderInteractive\Filter\Exception |
||
158 | * @expectedExceptionMessage 123-4 does not pass is_numeric |
||
159 | */ |
||
160 | public function filterNonDigitString() |
||
164 | |||
165 | /** |
||
166 | * @test |
||
167 | * @covers ::filter |
||
168 | * @expectedException \TraderInteractive\Filter\Exception |
||
169 | */ |
||
170 | public function filterHexString() |
||
174 | |||
175 | /** |
||
176 | * @test |
||
177 | * @covers ::filter |
||
178 | * @expectedException \TraderInteractive\Filter\Exception |
||
179 | * @expectedExceptionMessage 1. 0 does not pass is_numeric |
||
180 | */ |
||
181 | public function filterRogueSpaceStringAfterPeriod() |
||
185 | |||
186 | /** |
||
187 | * @test |
||
188 | * @covers ::filter |
||
189 | * @expectedException \TraderInteractive\Filter\Exception |
||
190 | * @expectedExceptionMessage 1 0 does not pass is_numeric |
||
191 | */ |
||
192 | public function filterRogueSpaceStringBetweenDigits() |
||
196 | |||
197 | /** |
||
198 | * @test |
||
199 | * @covers ::filter |
||
200 | * @expectedException \TraderInteractive\Filter\Exception |
||
201 | * @expectedExceptionMessage 1e999999999999 overflow |
||
202 | */ |
||
203 | public function filterOverflow() |
||
207 | |||
208 | /** |
||
209 | * @test |
||
210 | * @covers ::filter |
||
211 | * @expectedException \TraderInteractive\Filter\Exception |
||
212 | * @expectedExceptionMessage -1e999999999999 overflow |
||
213 | */ |
||
214 | public function filterUnderflow() |
||
218 | |||
219 | /** |
||
220 | * @test |
||
221 | * @covers ::filter |
||
222 | * @expectedException \TraderInteractive\Filter\Exception |
||
223 | * @expectedExceptionMessage -1 is less than 0 |
||
224 | */ |
||
225 | public function filterLessThanMin() |
||
229 | |||
230 | /** |
||
231 | * @test |
||
232 | * @covers ::filter |
||
233 | */ |
||
234 | public function filterEqualToMin() |
||
238 | |||
239 | /** |
||
240 | * @test |
||
241 | * @covers ::filter |
||
242 | * @expectedException \TraderInteractive\Filter\Exception |
||
243 | * @expectedExceptionMessage 1 is greater than 0 |
||
244 | */ |
||
245 | public function filterGreaterThanMax() |
||
249 | |||
250 | /** |
||
251 | * @test |
||
252 | * @covers ::filter |
||
253 | */ |
||
254 | public function filterEqualToMax() |
||
258 | |||
259 | /** |
||
260 | * @test |
||
261 | * @covers ::filter |
||
262 | */ |
||
263 | public function filterCastInts() |
||
267 | |||
268 | /** |
||
269 | * @test |
||
270 | * @covers ::filter |
||
271 | * @expectedException \TraderInteractive\Filter\Exception |
||
272 | * @expectedExceptionMessage "1" $value is not a string |
||
273 | */ |
||
274 | public function filterCastIntsIsFalse() |
||
278 | |||
279 | /** |
||
280 | * @test |
||
281 | * @covers ::filter |
||
282 | * @expectedException \InvalidArgumentException |
||
283 | * @expectedExceptionMessage "1" $castInts was not a bool |
||
284 | */ |
||
285 | public function filterCastIntsIsNotBool() |
||
289 | } |
||
290 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: