diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-08-08 16:38:22 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-08-08 16:38:22 +0100 |
commit | c193d4136a2dfb1a849cfccbbcacc4937931e54a (patch) | |
tree | f8d2f3a368c653d3480f983718df8919d95bbdde /perllib/FixMyStreet/App/Controller/Test.pm | |
parent | 1b3f2d621c6f2804c14118852cfe6835fd44b76d (diff) | |
parent | 3c51ee58f89e12cf7bea3bfa6a83bde9ef414dcf (diff) |
Merge branch 'westminster-report-dupe-bugs'
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Test.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Test.pm | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Test.pm b/perllib/FixMyStreet/App/Controller/Test.pm new file mode 100644 index 000000000..5ec4bebf3 --- /dev/null +++ b/perllib/FixMyStreet/App/Controller/Test.pm @@ -0,0 +1,60 @@ +package FixMyStreet::App::Controller::Test; +use Moose; +use namespace::autoclean; + +use File::Basename; + +BEGIN { extends 'Catalyst::Controller'; } + +=head1 NAME + +FixMyStreet::App::Controller::Test - Catalyst Controller + +=head1 DESCRIPTION + +Test-helping Catalyst Controller. + +=head1 METHODS + +=over 4 + +=item auto + +Makes sure this controller is only available when run in test. + +=cut + +sub auto : Private { + my ($self, $c) = @_; + $c->detach( '/page_error_404_not_found' ) unless FixMyStreet->test_mode; + return 1; +} + +=item setup + +Sets up a particular browser test. + +=cut + +sub setup : Path('/_test/setup') : Args(1) { + my ( $self, $c, $test ) = @_; + if ($test eq 'regression-duplicate-hide') { + my $problem = FixMyStreet::DB->resultset("Problem")->find(1); + $problem->update({ category => 'Skips' }); + $c->response->body("OK"); + } +} + +sub teardown : Path('/_test/teardown') : Args(1) { + my ( $self, $c, $test ) = @_; + if ($test eq 'regression-duplicate-hide') { + my $problem = FixMyStreet::DB->resultset("Problem")->find(1); + $problem->update({ category => 'Potholes' }); + $c->response->body("OK"); + } +} + +__PACKAGE__->meta->make_immutable; + +1; + |