aboutsummaryrefslogtreecommitdiffstats
path: root/t/Mock/Tilma.pm
diff options
context:
space:
mode:
Diffstat (limited to 't/Mock/Tilma.pm')
-rw-r--r--t/Mock/Tilma.pm39
1 files changed, 39 insertions, 0 deletions
diff --git a/t/Mock/Tilma.pm b/t/Mock/Tilma.pm
new file mode 100644
index 000000000..5a11209e3
--- /dev/null
+++ b/t/Mock/Tilma.pm
@@ -0,0 +1,39 @@
+package t::Mock::Tilma;
+
+use JSON::MaybeXS;
+use Web::Simple;
+
+has json => (
+ is => 'lazy',
+ default => sub {
+ JSON->new->utf8->pretty->allow_blessed->convert_blessed;
+ },
+);
+
+sub dispatch_request {
+ my $self = shift;
+
+ sub (GET + /mapserver/tfl + ?*) {
+ my ($self, $args) = @_;
+ my $features = [];
+ if ($args->{Filter} =~ /540512,169141/) {
+ $features = [
+ { type => "Feature", properties => { HA_ID => "19" }, geometry => { type => "Polygon", coordinates => [ [
+ [ 539408.94, 170607.58 ],
+ [ 539432.81, 170627.93 ],
+ [ 539437.24, 170623.48 ],
+ [ 539408.94, 170607.58 ],
+ ] ] } } ];
+ }
+ my $json = mySociety::Locale::in_gb_locale {
+ $self->json->encode({
+ type => "FeatureCollection",
+ crs => { type => "name", properties => { name => "urn:ogc:def:crs:EPSG::27700" } },
+ features => $features,
+ });
+ };
+ return [ 200, [ 'Content-Type' => 'application/json' ], [ $json ] ];
+ },
+}
+
+__PACKAGE__->run_if_script;