aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm2
-rw-r--r--t/app/controller/report_new.t51
2 files changed, 52 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index c3525b2c9..70bccd910 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -891,7 +891,7 @@ sub process_report : Private {
$c->stash->{report_meta} = { map { $_->{name} => $_ } @extra };
$report->extra( \@extra );
}
- } elsif ( @{ $c->stash->{area_ids_to_list} } ) {
+ } elsif ( @{ $c->stash->{bodies_to_list} } ) {
# There was an area with categories, but we've not been given one. Bail.
$c->stash->{field_errors}->{category} = _('Please choose a category');
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index f6a7b0824..783f3fb01 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -104,6 +104,57 @@ ok $contact7, "created test contact 7";
foreach my $test (
{
msg => 'all fields empty',
+ pc => 'OX1 3DH',
+ fields => {
+ title => '',
+ detail => '',
+ photo => '',
+ name => '',
+ may_show_name => '1',
+ email => '',
+ phone => '',
+ password_sign_in => '',
+ password_register => '',
+ remember_me => undef,
+ },
+ changes => {},
+ errors => [
+ 'Please enter a subject',
+ 'Please enter some details',
+ # No category error, as no categories for Oxon at all, so is skipped
+ 'Please enter your email',
+ 'Please enter your name',
+ ],
+ },
+ {
+ msg => 'all fields empty, bad category',
+ pc => 'GL50 2PR',
+ fields => {
+ title => '',
+ detail => '',
+ photo => '',
+ name => '',
+ may_show_name => '1',
+ email => '',
+ phone => '',
+ category => 'Something bad',
+ password_sign_in => '',
+ password_register => '',
+ remember_me => undef,
+ },
+ changes => {
+ category => '-- Pick a category --',
+ },
+ errors => [
+ 'Please enter a subject',
+ 'Please enter some details',
+ 'Please choose a category',
+ 'Please enter your email',
+ 'Please enter your name',
+ ],
+ },
+ {
+ msg => 'all fields empty except category',
pc => 'SW1A 1AA',
fields => {
title => '',