aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Zurich.pm2
-rw-r--r--perllib/FixMyStreet/Geocode.pm2
-rw-r--r--t/app/controller/report_display.t76
4 files changed, 78 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 4dea23a41..f253575c8 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -193,6 +193,8 @@ sub setup_request {
if ($c->cobrand->moniker eq 'zurich') {
FixMyStreet::DB::Result::Problem->visible_states_add_unconfirmed();
DateTime->DefaultLocale( 'de_CH' );
+ } else {
+ DateTime->DefaultLocale( 'en_US' );
}
return $c;
diff --git a/perllib/FixMyStreet/Cobrand/Zurich.pm b/perllib/FixMyStreet/Cobrand/Zurich.pm
index 6ac04ce1e..47f6d7d06 100644
--- a/perllib/FixMyStreet/Cobrand/Zurich.pm
+++ b/perllib/FixMyStreet/Cobrand/Zurich.pm
@@ -16,6 +16,8 @@ sub example_places {
return [ 'Langstrasse', 'Basteiplatz' ];
}
+sub languages { [ 'de-ch,Deutsch,de_CH', 'en-gb,English,en_GB' ] };
+
# If lat/lon are in the URI, we must have zoom as well, otherwise OpenLayers defaults to 0.
sub uri {
my ( $self, $uri ) = @_;
diff --git a/perllib/FixMyStreet/Geocode.pm b/perllib/FixMyStreet/Geocode.pm
index 6cfd960ed..61c398985 100644
--- a/perllib/FixMyStreet/Geocode.pm
+++ b/perllib/FixMyStreet/Geocode.pm
@@ -31,7 +31,7 @@ sub lookup {
}
# string STRING CONTEXT
-# Canonicalises, and then passes to some external API to look stuff up.
+# Passes the string to some external API to look stuff up.
sub string {
my ($s, $c) = @_;
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index 9847e3e51..10ef3dfd9 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -5,6 +5,7 @@ use Test::More;
use FixMyStreet::TestMech;
use Web::Scraper;
use Path::Class;
+use Test::LongString;
use DateTime;
my $mech = FixMyStreet::TestMech->new;
@@ -95,14 +96,14 @@ subtest "change report to unconfirmed and check for 404 status" => sub {
};
-subtest "change report to unconfirmed and check for 404 status" => sub {
+subtest "Zurich unconfirmeds are 200" => sub {
if ( !FixMyStreet::Cobrand->exists('zurich') ) {
plan skip_all => 'Skipping Zurich test without Zurich cobrand';
}
$mech->host( 'zurich.fixmystreet.com' );
ok $report->update( { state => 'unconfirmed' } ), 'unconfirm report';
- ok $mech->get("/report/$report_id"), "get '/report/$report_id'";
- is $mech->res->code, 200, "page found";
+ $mech->get_ok("/report/$report_id");
+ $mech->content_contains( 'This report is awaiting moderation' );
ok $report->update( { state => 'confirmed' } ), 'confirm report again';
$mech->host( 'www.fixmystreet.com' );
};
@@ -358,6 +359,75 @@ for my $test (
};
}
+subtest "Zurich banners are displayed correctly" => sub {
+ if ( !FixMyStreet::Cobrand->exists('zurich') ) {
+ plan skip_all => 'Skipping Zurich test without Zurich cobrand';
+ }
+ $mech->host( 'zurich.fixmystreet.com' );
+
+ for my $test (
+ {
+ description => 'new report',
+ state => 'unconfirmed',
+ banner_id => 'closed',
+ banner_text => 'Erfasst'
+ },
+ {
+ description => 'confirmed report',
+ state => 'confirmed',
+ banner_id => 'closed',
+ banner_text => 'Aufgenommen',
+ },
+ {
+ description => 'fixed report',
+ state => 'fixed - council',
+ banner_id => 'fixed',
+ banner_text => 'Erledigt',
+ },
+ {
+ description => 'closed report',
+ state => 'closed',
+ banner_id => 'fixed',
+ banner_text => 'Erledigt',
+ },
+ {
+ description => 'in progress report',
+ state => 'in progress',
+ banner_id => 'progress',
+ banner_text => 'In Bearbeitung',
+ },
+ {
+ description => 'planned report',
+ state => 'planned',
+ banner_id => 'progress',
+ banner_text => 'In Bearbeitung',
+ },
+ ) {
+ subtest "banner for $test->{description}" => sub {
+ $report->state( $test->{state} );
+ $report->update;
+
+ $mech->get_ok("/report/$report_id");
+ is $mech->uri->path, "/report/$report_id", "at /report/$report_id";
+ my $banner = $mech->extract_problem_banner;
+ if ( $banner->{text} ) {
+ $banner->{text} =~ s/^ //g;
+ $banner->{text} =~ s/ $//g;
+ }
+
+ is $banner->{id}, $test->{banner_id}, 'banner id';
+ if ($test->{banner_text}) {
+ like_string( $banner->{text}, qr/$test->{banner_text}/i, 'banner text is ' . $test->{banner_text} );
+ } else {
+ is $banner->{text}, $test->{banner_text}, 'banner text';
+ }
+
+ };
+ }
+
+ $mech->host( 'www.fixmystreet.com' );
+};
+
$mech->create_body_ok(2504, 'Westminster City Council');
$mech->create_body_ok(2505, 'Camden Borough Council');