diff options
author | Dave Arter <davea@mysociety.org> | 2016-12-13 16:41:00 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-12-13 16:41:00 +0000 |
commit | b8aa0d6da9009dc3182093165df9b1a4c6d7d164 (patch) | |
tree | faac683c3d9a5ec56b9e54d8913742f1169f0f5e /t/app/model/problem.t | |
parent | 93180a49cb9f56cd92c97ea1e22cf5cc9dd7194a (diff) | |
parent | ec6389940afce877a0bc7771d11a27ee7183f96a (diff) |
Merge branch 'issues/forcouncils/18-merge-duplicate-reports'
Diffstat (limited to 't/app/model/problem.t')
-rw-r--r-- | t/app/model/problem.t | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/app/model/problem.t b/t/app/model/problem.t index bd7d0e55c..1130078c0 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -763,6 +763,17 @@ subtest 'check response templates' => sub { is $problem->response_templates, 2, 'Global and pothole templates returned'; }; +subtest 'check duplicate reports' => sub { + my ($problem1, $problem2) = $mech->create_problems_for_body(2, $body_ids{2651}, 'TITLE'); + $problem1->set_extra_metadata(duplicate_of => $problem2->id); + $problem1->state('duplicate'); + $problem1->update; + + is $problem1->duplicate_of->title, $problem2->title, 'problem1 returns correct problem from duplicate_of'; + is scalar @{ $problem2->duplicates }, 1, 'problem2 has correct number of duplicates'; + is $problem2->duplicates->[0]->title, $problem1->title, 'problem2 includes problem1 in duplicates'; +}; + END { $problem->comments->delete if $problem; $problem->delete if $problem; |