CParser::PARSE_SUCCESS, 'result' => [ 'latitude' => '51.5285582', 'longitude' => '-0.2813', 'zoom' => '10' ] ]], ['51.5285582,-0.2416813', 0, [ 'rc' => CParser::PARSE_SUCCESS, 'result' => [ 'latitude' => '51.5285582', 'longitude' => '-0.2416813' ] ]], // PARSE_FAIL ['91.5285582,-0.2416813,10', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], ['-91.5285582,-0.2416813,10', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], ['90,181,10', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], ['90,-181,10', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], ['90,100,29.9', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], ['51.5285582,180,10,10', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], ['51.5285582,,10', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], [',51.5285582,10', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], [',,', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]], ['', 0, [ 'rc' => CParser::PARSE_FAIL, 'result' => [] ]] ]; } /** * @dataProvider dataProvider * * @param string $source * @param int $pos * @param array $expected */ public function testParse($source, $pos, $expected) { $geo_coordinates_parser = new CGeomapCoordinatesParser(); $this->assertSame($expected, [ 'rc' => $geo_coordinates_parser->parse($source, $pos), 'result' => $geo_coordinates_parser->result ]); } }