aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-03-09 13:28:31 +0000
committerMatthew Somerville <matthew@mysociety.org>2020-03-09 15:42:40 +0000
commit468e81212c9a15f25a3ae6bf9c94505f02cdc7e7 (patch)
tree6150ee30feb65cd6697add9a868773187cf63afd
parent630ad091519dff8aa9371502005fbb788d349632 (diff)
A number of warnfixes in tests.
-rw-r--r--perllib/FixMyStreet/App/Controller/Location.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--perllib/FixMyStreet/Map/UKCouncilWMTS.pm1
-rw-r--r--t/cobrand/cheshireeast.t3
4 files changed, 6 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Location.pm b/perllib/FixMyStreet/App/Controller/Location.pm
index 81c2c33fc..416fb942a 100644
--- a/perllib/FixMyStreet/App/Controller/Location.pm
+++ b/perllib/FixMyStreet/App/Controller/Location.pm
@@ -112,7 +112,7 @@ sub determine_location_from_pc : Private {
# Log failure in a log db
try {
my $dbfile = FixMyStreet->path_to('../data/analytics.sqlite');
- my $db = DBI->connect("dbi:SQLite:dbname=$dbfile", undef, undef) or die "$DBI::errstr\n";
+ my $db = DBI->connect("dbi:SQLite:dbname=$dbfile", undef, undef, { PrintError => 0 }) or die "$DBI::errstr\n";
my $sth = $db->prepare("INSERT INTO location_searches_with_no_results
(datetime, cobrand, geocoder, url, user_input)
VALUES (?, ?, ?, ?, ?)") or die $db->errstr . "\n";
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index faa02f9fe..1a300da21 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -1247,7 +1247,7 @@ sub check_for_errors : Private {
if ( $c->cobrand->allow_anonymous_reports ) {
my $anon_details = $c->cobrand->anonymous_account;
$report->user->email(undef) if $report->user->email eq $anon_details->{email};
- $report->name(undef) if $report->name eq $anon_details->{name};
+ $report->name(undef) if $report->name && $report->name eq $anon_details->{name};
}
return;
diff --git a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
index 7e3522714..53b6859bf 100644
--- a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
+++ b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm
@@ -45,6 +45,7 @@ sub reproject_from_latlon($$$) {
# Reproject a BNG easting/northing into WGS84 lat/lon
sub reproject_to_latlon($$$) {
my ($self, $x, $y) = @_;
+ return (0,0) if $x<0 || $y<0;
my ($lat, $lon) = Utils::convert_en_to_latlon($x, $y);
return ($lat, $lon);
}
diff --git a/t/cobrand/cheshireeast.t b/t/cobrand/cheshireeast.t
index c6c8198ab..4924a96ee 100644
--- a/t/cobrand/cheshireeast.t
+++ b/t/cobrand/cheshireeast.t
@@ -4,6 +4,9 @@ use FixMyStreet::TestMech;
use FixMyStreet::Script::Alerts;
use FixMyStreet::Script::Reports;
+FixMyStreet::App->log->disable('info');
+END { FixMyStreet::App->log->enable('info'); }
+
my $mech = FixMyStreet::TestMech->new;
my $body = $mech->create_body_ok( 21069, 'Cheshire East Council', {