aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock
diff options
context:
space:
mode:
Diffstat (limited to 't/Mock')
-rw-r--r--t/Mock/MapIt.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/t/Mock/MapIt.pm b/t/Mock/MapIt.pm
index 43d44d519..0b355983b 100644
--- a/t/Mock/MapIt.pm
+++ b/t/Mock/MapIt.pm
@@ -31,6 +31,7 @@ my @PLACES = (
[ '?', 50.78301, -0.646929 ],
[ 'GU51 4AE', 51.279456, -0.846216, 2333, 'Hart District Council', 'DIS', 2227, 'Hampshire County Council', 'CTY' ],
[ 'WS1 4NH', 52.563074, -1.991032, 2535, 'Sandwell Borough Council', 'MTD' ],
+ [ 'OX28 4DS', 51.784721, -1.494453 ],
);
sub dispatch_request {
@@ -105,6 +106,19 @@ sub dispatch_request {
my ($self, $area) = @_;
return [ 200, [ 'Content-Type' => 'application/json' ], [ '"AB12 1AA"' ] ];
},
+
+ sub (GET + /nearest/**.*) {
+ my ($self, $point) = @_;
+ foreach (@PLACES) {
+ if ($point eq "4326/$_->[2],$_->[1]") {
+ return $self->output({
+ postcode => { wgs84_lat => $_->[1], wgs84_lon => $_->[2], postcode => $_->[0] },
+ });
+ }
+ }
+ return $self->output({});
+ },
+
}
LWP::Protocol::PSGI->register(t::Mock::MapIt->to_psgi_app, host => 'mapit.uk');