diff options
Diffstat (limited to 't/map/tilma/original.t')
-rw-r--r-- | t/map/tilma/original.t | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/t/map/tilma/original.t b/t/map/tilma/original.t index 04c4d578c..f16f5b244 100644 --- a/t/map/tilma/original.t +++ b/t/map/tilma/original.t @@ -1,38 +1,34 @@ -#!/usr/bin/perl - use strict; use warnings; use Test::More; -use FixMyStreet::App; +use FixMyStreet::DB; use FixMyStreet::Map; use FixMyStreet::TestMech; use DateTime; use mySociety::Locale; +use Catalyst::Test 'FixMyStreet::App'; + my $mech = FixMyStreet::TestMech->new; mySociety::Locale::gettext_domain('FixMyStreet'); FixMyStreet::Map::set_map_class(); -my $r = Catalyst::Request->new( { base => URI->new('/'), uri => URI->new('http://fixmystreet.com/test'), parameters => { bbox => '-7.6,49.7,-7.5,49.8' } } ); - -my $c = FixMyStreet::App->new( { - request => $r, -}); +my $c = ctx_request('http://fixmystreet.com/test?bbox=-7.6,49.7,-7.5,49.8'); $mech->delete_user('test@example.com'); my $user = - FixMyStreet::App->model('DB::User') + FixMyStreet::DB->resultset('User') ->find_or_create( { email => 'test@example.com', name => 'Test User' } ); ok $user, "created test user"; my $dt = DateTime->now(); -my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( +my $report = FixMyStreet::DB->resultset('Problem')->find_or_create( { postcode => 'SW1A 1AA', - council => '2504', + bodies_str => '2504', areas => ',105255,11806,11828,2247,2504,', category => 'Other', title => 'Test 2', @@ -71,10 +67,26 @@ for my $test ( colour => 'yellow', }, { + state => 'duplicate', + colour => 'yellow', + }, + { + state => 'unable to fix', + colour => 'yellow', + }, + { + state => 'not responsible', + colour => 'yellow', + }, + { state => 'investigating', colour => 'yellow', }, { + state => 'action scheduled', + colour => 'yellow', + }, + { state => 'planned', colour => 'yellow', }, @@ -87,18 +99,18 @@ for my $test ( $report->state($test->{state}); $report->update; - my ( $pins, $around_map_list, $nearby, $dist ) = - FixMyStreet::Map::map_pins( $c, 0, 0, 0, 0 ); + my ( $on_map_all, $on_map_list, $nearby, $dist ) = + FixMyStreet::Map::map_features($c, bbox => "0,0,0,0"); - ok $pins; - ok $around_map_list; + ok $on_map_list; ok $nearby; ok $dist; my $id = $report->id; my $colour = $test->{colour}; - is $pins->[0][2], $colour, 'pin colour'; + my $pin_colour = $c->cobrand->pin_colour($on_map_all->[0], 'around'); + is $pin_colour, $colour, 'pin colour'; }; } |