aboutsummaryrefslogtreecommitdiffstats
path: root/t/cobrand
diff options
context:
space:
mode:
authorChris Mytton <self@hecticjeff.net>2013-09-12 17:08:46 +0100
committerChris Mytton <self@hecticjeff.net>2013-09-12 17:40:56 +0100
commit04cfac32dd1914fef76f8c9df272f686f880890c (patch)
tree88458307022f0a184c54e936d926ada80f29f4b1 /t/cobrand
parent008754424d027a7cdefa4a2f09c4cb937d972693 (diff)
[Zurich] Put the phone number test into a subtest block
Diffstat (limited to 't/cobrand')
-rw-r--r--t/cobrand/zurich.t59
1 files changed, 30 insertions, 29 deletions
diff --git a/t/cobrand/zurich.t b/t/cobrand/zurich.t
index d7e63c84e..40baa4f04 100644
--- a/t/cobrand/zurich.t
+++ b/t/cobrand/zurich.t
@@ -346,37 +346,38 @@ $mech->get_ok( '/admin/bodies' );
$mech->content_lacks( '<form method="post" action="bodies"' );
$mech->log_out_ok;
-# Test phone number is mandatory
-$user = $mech->log_in_ok( 'dm1@example.org' );
+subtest "phone number is mandatory" => sub {
+ # Capture the bits of the original config that the following code will use
+ my %config =
+ map {$_ => FixMyStreet->config($_)}
+ qw(ALLOWED_COBRANDS FMS_DB_NAME MAPIT_ID_WHITELIST STAGING_SITE);
-# Capture the bits of the original config that the following code will use
-my %config =
- map {$_ => FixMyStreet->config($_)}
- qw(ALLOWED_COBRANDS FMS_DB_NAME MAPIT_ID_WHITELIST STAGING_SITE);
-
-# Change the MAPIT_TYPES value for this test
-$config{MAPIT_TYPES} = [ 'O08' ];
-$config{MAPIT_URL} = 'http://global.mapit.mysociety.org/';
-mySociety::MaPit::configure($config{MAPIT_URL});
-
-# Override the get function to return values from our captured config. This
-# override will be cleared at the end of this block when the $override guard
-# falls out of scope.
-my $override_guard = Sub::Override->new(
- "FixMyStreet::config",
- sub {
- my ($self, $key, $default) = @_;
- exists $config{$key}
- ? return $config{$key}
- : die "Need to cache config key '$key' here";
- }
-);
+ # Change the MAPIT_TYPES and MAPIT_URL values for this test
+ $config{MAPIT_TYPES} = [ 'O08' ];
+ $config{MAPIT_URL} = 'http://global.mapit.mysociety.org/';
+ mySociety::MaPit::configure($config{MAPIT_URL});
-$mech->get_ok( '/report/new?lat=47.381817&lon=8.529156' );
-$mech->submit_form( with_fields => { phone => "" } );
-$mech->content_contains( 'Diese Information wird ben&ouml;tigt' );
-$override_guard->restore();
-$mech->log_out_ok;
+ # Override the get function to return values from our captured config. This
+ # override will be cleared at the end of this block when the $override guard
+ # falls out of scope.
+ my $override_guard = Sub::Override->new(
+ "FixMyStreet::config",
+ sub {
+ my ($self, $key, $default) = @_;
+ exists $config{$key}
+ ? return $config{$key}
+ : die "Need to cache config key '$key' here";
+ }
+ );
+
+ $user = $mech->log_in_ok( 'dm1@example.org' );
+ $mech->get_ok( '/report/new?lat=47.381817&lon=8.529156' );
+ $mech->submit_form( with_fields => { phone => "" } );
+ $mech->content_contains( 'Diese Information wird ben&ouml;tigt' );
+ $mech->log_out_ok;
+
+ $override_guard->restore();
+};
# Test problems can't be assigned to deleted bodies
$user = $mech->log_in_ok( 'dm1@example.org' );