blob: 5ec4bebf3d1a33e3cec3176b86da5cedef3ef555 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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;
|