aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App/Controller/Test.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Test.pm')
-rw-r--r--perllib/FixMyStreet/App/Controller/Test.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Test.pm b/perllib/FixMyStreet/App/Controller/Test.pm
index 5ec4bebf3..19a8c5321 100644
--- a/perllib/FixMyStreet/App/Controller/Test.pm
+++ b/perllib/FixMyStreet/App/Controller/Test.pm
@@ -42,6 +42,25 @@ sub setup : Path('/_test/setup') : Args(1) {
my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
$problem->update({ category => 'Skips' });
$c->response->body("OK");
+ } elsif ( $test eq 'regression-duplicate-stopper') {
+ my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
+ $problem->update({ category => 'Flytipping' });
+ my $category = FixMyStreet::DB->resultset('Contact')->search({
+ category => 'Flytipping',
+ })->first;
+ $category->push_extra_fields({
+ code => 'hazardous',
+ datatype => 'singlevaluelist',
+ description => 'Hazardous material',
+ order => 0,
+ variable => 'true',
+ values => [
+ { key => 'yes', name => 'Yes', disable => 1, disable_message => 'Please phone' },
+ { key => 'no', name => 'No' },
+ ],
+ });
+ $category->update;
+ $c->response->body("OK");
}
}
@@ -51,6 +70,15 @@ sub teardown : Path('/_test/teardown') : Args(1) {
my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
$problem->update({ category => 'Potholes' });
$c->response->body("OK");
+ } elsif ( $test eq 'regression-duplicate-stopper') {
+ my $problem = FixMyStreet::DB->resultset("Problem")->find(1);
+ $problem->update({ category => 'Potholes' });
+ my $category = FixMyStreet::DB->resultset('Contact')->search({
+ category => 'Flytipping',
+ })->first;
+ $category->remove_extra_field('hazardous');
+ $category->update;
+ $c->response->body("OK");
}
}