diff options
author | Marius Halden <marius.h@lden.org> | 2018-05-29 19:37:34 +0200 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2018-05-29 19:37:34 +0200 |
commit | 782457d016084c8de04989dbc824a71899f8b41b (patch) | |
tree | 56d14e1a988396e43c8693ff3486e40d16962add /t/app/controller/around.t | |
parent | 140d40e3eab4cb1e7aa9f95cbc24a0f13180b606 (diff) | |
parent | 6e2da95bc6a758c0cf070b9ddd51acc769f7acf1 (diff) |
Merge tag 'v2.3.1' into fiksgatami-dev
Diffstat (limited to 't/app/controller/around.t')
-rw-r--r-- | t/app/controller/around.t | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t index d1254edb7..618998513 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -137,25 +137,28 @@ subtest 'check non public reports are not displayed on around page' => sub { }; -subtest 'check category and status filtering works on /around?ajax' => sub { +subtest 'check category and status filtering works on /around' => sub { + my $body = $mech->create_body_ok(2237, "Oxfordshire"); + my $categories = [ 'Pothole', 'Vegetation', 'Flytipping' ]; my $params = { - postcode => 'OX1 1ND', - latitude => 51.7435918829363, - longitude => -1.23201966270446, + postcode => 'OX20 1SZ', + latitude => 51.754926, + longitude => -1.256179, }; my $bbox = ($params->{longitude} - 0.01) . ',' . ($params->{latitude} - 0.01) . ',' . ($params->{longitude} + 0.01) . ',' . ($params->{latitude} + 0.01); # Create one open and one fixed report in each category foreach my $category ( @$categories ) { + $mech->create_contact_ok( category => $category, body_id => $body->id, email => "$category\@example.org" ); foreach my $state ( 'confirmed', 'fixed' ) { my %report_params = ( %$params, category => $category, state => $state, ); - $mech->create_problems_for_body( 1, 2237, 'Around page', \%report_params ); + $mech->create_problems_for_body( 1, $body->id, 'Around page', \%report_params ); } } @@ -163,6 +166,14 @@ subtest 'check category and status filtering works on /around?ajax' => sub { my $pins = $json->{pins}; is scalar @$pins, 6, 'correct number of reports when no filters'; + # Regression test for filter_category in /around URL + FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok( '/around?filter_category=Pothole&bbox=' . $bbox ); + $mech->content_contains('<option value="Pothole" selected>'); + }; + $json = $mech->get_ok_json( '/around?ajax=1&filter_category=Pothole&bbox=' . $bbox ); $pins = $json->{pins}; is scalar @$pins, 2, 'correct number of Pothole reports'; |