emcconville / google-map-polyline-encoding-tool

A simple class to handle polyline-encoding for Google Maps
Other
154 stars 40 forks source link

Refactor polyline #7

Open martinlindhe opened 10 years ago

martinlindhe commented 10 years ago

This patch series reworks the internals a little bit, mostly around the polyline() method and splits it in 3 methods.

Notice: before this patch series, phpunit reports 100% code coverage. But i believe this is actually phpunit being buggy. Reworking the code now shows 2 spots uncovered by tests:

1) the polyline('nodename', 'encodedstring') case was not covered by a test, the code path turned red (uncovered) when refactored. I tried make a test case for this, but it does not seem to agree. Either there is a bug in that code path, or my test is wrong. The method returns an array of multiple points, rather than what i expected, an array containing arrays with lat,long pairs.

2) the Pair(null) case was not covered by a test: single line: if (!is_array($list)) { return $pairs; } turned red (uncovered) when rewritten to multi line