/** * Tests Valid::decimal() * * @test * @dataProvider provider_decimal * @param string $decimal The decimal to validate * @param integer $places The number of places to check to * @param integer $digits The number of digits preceding the point to check * @param boolean $expected Whether $decimal conforms to $places AND $digits */ public function test_decimal($decimal, $places, $digits, $expected) { $this->assertSame($expected, Valid::decimal($decimal, $places, $digits), 'Decimal: "' . $decimal . '" to ' . $places . ' places and ' . $digits . ' digits (preceeding period)'); }
protected function validate($value) { if (!Valid::decimal($value)) { return 'decimal'; } }