*/ class NumericTest extends TestCase { /** * Test the method tao_helpers_Numeric::parseFloat * * @dataProvider floatProvider */ public function testParseFloat($input, $expected) { $result = tao_helpers_Numeric::parseFloat($input); $this->assertEquals($expected, $result); } /** * Provides test case data * as input value / expected parsed float */ public function floatProvider() { return [ [ '0.1', 0.1 ], [ 0.1, 0.1 ], [ null, 0.0 ], [ false, 0.0 ], [ 'foo', 0.0 ], [ 'foo12.5', 12.5 ], [ '12.5foo', 12.5 ], [ '-27.541foo', -27.541 ], [ 'bar-27.541foo', -27.541 ], [ '1 000,54', 1000.54 ], [ 1234, 1234.0 ], [ '02.34', 2.34 ], [ '02,340', 2.34 ], ]; } }