aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/TestMech.pm1
-rw-r--r--t/app/controller/dashboard.t14
-rw-r--r--t/cobrand/isleofwight.t4
-rw-r--r--t/open311/post-service-request-updates.t2
4 files changed, 11 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index cc2020b63..e8b08ef19 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -741,6 +741,7 @@ sub create_comment_for_problem {
$params->{problem_state} = $problem_state;
$params->{state} = $state;
$params->{mark_fixed} = $problem_state && FixMyStreet::DB::Result::Problem->fixed_states()->{$problem_state} ? 1 : 0;
+ $params->{confirmed} = \'current_timestamp' unless $params->{confirmed} || $state eq 'unconfirmed';
FixMyStreet::App->model('DB::Comment')->create($params);
}
diff --git a/t/app/controller/dashboard.t b/t/app/controller/dashboard.t
index ff8d1a9d5..061809aaf 100644
--- a/t/app/controller/dashboard.t
+++ b/t/app/controller/dashboard.t
@@ -46,9 +46,13 @@ my @scheduled_problems = $mech->create_problems_for_body(7, $body->id, 'Title',
my @fixed_problems = $mech->create_problems_for_body(4, $body->id, 'Title', { areas => ",$area_id,2651,", category => 'Potholes', cobrand => 'fixmystreet' });
my @closed_problems = $mech->create_problems_for_body(3, $body->id, 'Title', { areas => ",$area_id,2651,", category => 'Traffic lights', cobrand => 'fixmystreet' });
+my $first_problem_id;
+my $first_update_id;
foreach my $problem (@scheduled_problems) {
$problem->update({ state => 'action scheduled' });
- $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'action scheduled');
+ my ($update) = $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'action scheduled');
+ $first_problem_id = $problem->id unless $first_problem_id;
+ $first_update_id = $update->id unless $first_update_id;
}
foreach my $problem (@fixed_problems) {
@@ -56,13 +60,9 @@ foreach my $problem (@fixed_problems) {
$mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'fixed');
}
-my $first_problem_id;
-my $first_update_id;
foreach my $problem (@closed_problems) {
$problem->update({ state => 'closed' });
- my ($update) = $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'closed', { confirmed => \'current_timestamp' });
- $first_problem_id = $problem->id unless $first_problem_id;
- $first_update_id = $update->id unless $first_update_id;
+ $mech->create_comment_for_problem($problem, $counciluser, 'Title', 'text', 0, 'confirmed', 'closed');
}
my $categories = scraper {
@@ -218,7 +218,7 @@ FixMyStreet::override_config {
is $rows[1]->[0], $first_problem_id, 'Correct report ID';
is $rows[1]->[1], $first_update_id, 'Correct update ID';
is $rows[1]->[3], 'confirmed', 'Correct state';
- is $rows[1]->[4], 'closed', 'Correct problem state';
+ is $rows[1]->[4], 'action scheduled', 'Correct problem state';
is $rows[1]->[5], 'text', 'Correct text';
is $rows[1]->[6], 'Title', 'Correct name';
};
diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t
index 67088bc54..1eb710e97 100644
--- a/t/cobrand/isleofwight.t
+++ b/t/cobrand/isleofwight.t
@@ -255,7 +255,7 @@ subtest "fixing passes along the correct message" => sub {
like $cgi->param('description'), qr/^FMS-Update:/, 'FMS update prefix included';
unlike $cgi->param('description'), qr/The customer indicated that this issue had been fixed/, 'No fixed message included';
- $c = $mech->create_comment_for_problem($p, $p->user, 'Name', 'Update text', 'f', 'confirmed', 'fixed - user', { confirmed => \'current_timestamp' });
+ $c = $mech->create_comment_for_problem($p, $p->user, 'Name', 'Update text', 'f', 'confirmed', 'fixed - user');
$c->discard_changes; # Otherwise cannot set_nanosecond
$id = $o->post_service_request_update($c);
@@ -367,7 +367,7 @@ my $alert = FixMyStreet::App->model('DB::Alert')->create( {
} )->confirm;
subtest "sends branded alert emails" => sub {
- $mech->create_comment_for_problem($p, $system_user, 'Other User', 'This is some update text', 'f', 'confirmed', undef, { confirmed => DateTime->now->add( minutes => 5 ) });
+ $mech->create_comment_for_problem($p, $system_user, 'Other User', 'This is some update text', 'f', 'confirmed', undef);
$mech->clear_emails_ok;
FixMyStreet::override_config {
diff --git a/t/open311/post-service-request-updates.t b/t/open311/post-service-request-updates.t
index ac6fb870c..adfd4e3c5 100644
--- a/t/open311/post-service-request-updates.t
+++ b/t/open311/post-service-request-updates.t
@@ -61,7 +61,7 @@ my $other_user = $mech->create_user_ok('test2@example.com', title => 'MRS');
sub c {
my ($p, $user) = @_;
- my $c = $mech->create_comment_for_problem($p, $user || $p->user, 'Name', 'Update text', 'f', 'confirmed', 'confirmed', { confirmed => \'current_timestamp' });
+ my $c = $mech->create_comment_for_problem($p, $user || $p->user, 'Name', 'Update text', 'f', 'confirmed', 'confirmed');
$c->discard_changes;
return $c;
}