aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-11-09 18:08:05 +0000
committerMatthew Somerville <matthew@mysociety.org>2012-11-09 18:08:05 +0000
commitc0e4463163d4a9b9a8be073964ef960b114c9ea0 (patch)
tree8724404283e105fb04b857210825ec78cad1e7cb
parent55fd02987a0816d9d1c8a76b67fa2d44f8d57264 (diff)
Some fixes for when warnings are on during test run.
-rw-r--r--Makefile.PL2
-rw-r--r--perllib/FixMyStreet/App/Controller/Alert.pm2
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm13
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/UK.pm2
-rw-r--r--perllib/Open311.pm2
-rw-r--r--perllib/Utils.pm1
-rw-r--r--t/app/controller/alert.t2
-rw-r--r--t/app/controller/alert_new.t2
9 files changed, 20 insertions, 8 deletions
diff --git a/Makefile.PL b/Makefile.PL
index aba781785..92f08e405 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -49,6 +49,8 @@ test_requires 'Test::More' => '0.88';
test_requires 'Test::WWW::Mechanize::Catalyst';
test_requires 'Sub::Override';
+tests 't/*.t t/*/*.t t/*/*/*.t t/*/*/*/*.t t/*/*/*/*/*.t';
+
catalyst;
install_script glob('script/*.pl');
diff --git a/perllib/FixMyStreet/App/Controller/Alert.pm b/perllib/FixMyStreet/App/Controller/Alert.pm
index 4e5319a59..91ea61fbc 100644
--- a/perllib/FixMyStreet/App/Controller/Alert.pm
+++ b/perllib/FixMyStreet/App/Controller/Alert.pm
@@ -438,7 +438,7 @@ sub determine_location : Private {
$c->detach('choose');
}
- $c->go('index') if $c->stash->{location_error};
+ $c->go('index');
}
# truncate the lat,lon for nicer urls
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index fe4b652ed..baaa3b927 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -106,10 +106,19 @@ sub local_problems_pc_distance : Path('pc') : Args(2) {
}
-sub local_problems : LocalRegex('^(n|l)/([\d.-]+)[,/]([\d.-]+)(?:/(\d+))?$') {
+sub local_problems_dist : LocalRegex('^(n|l)/([\d.-]+)[,/]([\d.-]+)/(\d+)$') {
my ( $self, $c ) = @_;
+ $c->forward( 'local_problems', $c->req->captures );
+}
+
+sub local_problems_no_dist : LocalRegex('^(n|l)/([\d.-]+)[,/]([\d.-]+)$') {
+ my ( $self, $c ) = @_;
+ $c->forward( 'local_problems', $c->req->captures );
+}
+
+sub local_problems : Private {
+ my ( $self, $c, $type, $a, $b, $d ) = @_;
- my ( $type, $a, $b, $d) = @{ $c->req->captures };
$c->forward( 'get_query_parameters', [ $d ] );
$c->detach( 'redirect_lat_lon', [ $a, $b ] )
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index b9a893778..a6c9c6fba 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -697,7 +697,7 @@ If set to an arrayref, will plot those area ID(s) from mapit on all the /around
=cut
-sub areas_on_around {}
+sub areas_on_around { []; }
sub process_extras {}
diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm
index dfdce641e..58da5166c 100644
--- a/perllib/FixMyStreet/Cobrand/UK.pm
+++ b/perllib/FixMyStreet/Cobrand/UK.pm
@@ -45,7 +45,7 @@ sub process_extras {
my $extra = shift;
my $fields = shift || [];
- if ( $area_id == 2482 ) {
+ if ( $area_id eq '2482' ) {
my @fields = ( 'fms_extra_title', @$fields );
for my $field ( @fields ) {
my $value = $ctx->request->param( $field );
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index ef430d628..603eae777 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -419,7 +419,7 @@ sub _get_xml_object {
my $obj;
eval {
- $obj = $simple ->XMLin( $xml );
+ $obj = $simple ->parse_string( $xml );
};
return $obj;
diff --git a/perllib/Utils.pm b/perllib/Utils.pm
index 09c7386b4..ab7bc6e12 100644
--- a/perllib/Utils.pm
+++ b/perllib/Utils.pm
@@ -241,6 +241,7 @@ sub cleanup_text {
sub prettify_epoch {
my ( $epoch, $type ) = @_;
+ $type ||= '';
$type = 'short' if $type eq '1';
my $dt = DateTime->from_epoch( epoch => $epoch, time_zone => 'local' );
diff --git a/t/app/controller/alert.t b/t/app/controller/alert.t
index e1ebbecb6..3d95bef6d 100644
--- a/t/app/controller/alert.t
+++ b/t/app/controller/alert.t
@@ -40,7 +40,7 @@ $mech->get_ok('/alert/list?pc=High Street');
$mech->content_contains('We found more than one match for that location');
$mech->get_ok('/alert/list?pc=');
-$mech->content_contains('hat location does not appear to be covered by a council');
+$mech->content_contains('To find out what local alerts we have for you');
$mech->get_ok('/alert/list?pc=GL502PR');
$mech->content_contains('Problems within the boundary of');
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index c89f37028..c849b9485 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -330,7 +330,7 @@ subtest "Test two-tier council alerts" => sub {
feed => $alert->{feed},
}
} );
- is $mech->uri->path, $alert->{result};
+ is $mech->uri->path, $alert->{result}, 'Redirected to right RSS feed';
}
};