File Coverage

blib/lib/Socialtext/WikiFixture/TestUtils.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Socialtext::WikiFixture::TestUtils;
2 1     1   41808 use strict;
  1         1  
  1         38  
3 1     1   5 use warnings;
  1         1  
  1         23  
4 1     1   5 use Test::More;
  1         5  
  1         9  
5 1     1   2694 use Socialtext::Resting::Mock;
  0            
  0            
6             use mocked 'Test::WWW::Selenium', qw/$SEL/;
7              
8             use base 'Exporter';
9             our @EXPORT_OK = qw/fixture_ok/;
10              
11             my $rester = Socialtext::Resting::Mock->new;
12              
13             sub fixture_ok {
14             my %args = @_;
15              
16             ok 1, $args{name};
17              
18             $rester->put_page('Test Plan', $args{plan});
19             my $plan = Socialtext::WikiObject::TestPlan->new(
20             rester => $rester,
21             page => 'Test Plan',
22             default_fixture => $args{default_fixture},
23             fixture_args => {
24             host => 'selenium-server',
25             username => 'testuser',
26             password => 'password',
27             browser_url => 'http://server',
28             workspace => 'foo',
29             %{ $args{fixture_args} || {} },
30             },
31             );
32              
33             if ($args{sel_setup}) {
34             for my $s (@{$args{sel_setup}}) {
35             $SEL->set_return_value(@$s);
36             }
37             }
38              
39             $plan->run_tests;
40              
41             for my $t (@{$args{tests}}) {
42             $SEL->method_args_ok(@$t);
43             }
44              
45             $SEL->method_args_ok('stop', undef);
46             $SEL->empty_ok($args{extra_calls_ok});
47             }
48              
49             1;