| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::DBIx::Class::FixtureCommand::PopulateMore; { |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1732
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use Test::More (); |
|
5
|
|
|
|
|
|
|
use DBIx::Class::Schema::PopulateMore::Command; |
|
6
|
|
|
|
|
|
|
with 'Test::DBIx::Class::Role::FixtureCommand'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub install_fixtures { |
|
9
|
|
|
|
|
|
|
my ($self, $arg, @rest) = @_; |
|
10
|
|
|
|
|
|
|
my $builder = $self |
|
11
|
|
|
|
|
|
|
->schema_manager |
|
12
|
|
|
|
|
|
|
->builder; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
$builder->croak("Argument is required.") |
|
15
|
|
|
|
|
|
|
unless $arg; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my @args; |
|
18
|
|
|
|
|
|
|
if(ref $arg && ref $arg eq 'ARRAY') { |
|
19
|
|
|
|
|
|
|
@args = @$arg; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
elsif(ref $arg && ref $arg eq 'HASH') { |
|
22
|
|
|
|
|
|
|
@args = %$arg; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
else { |
|
25
|
|
|
|
|
|
|
@args = ($arg, @rest); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my @definitions; |
|
29
|
|
|
|
|
|
|
while(@args) { |
|
30
|
|
|
|
|
|
|
my $next = shift(@args); |
|
31
|
|
|
|
|
|
|
if( (ref $next) && (ref $next eq 'HASH') ) { |
|
32
|
|
|
|
|
|
|
push @definitions, $next; |
|
33
|
|
|
|
|
|
|
} else { |
|
34
|
|
|
|
|
|
|
my $value = shift(@args); |
|
35
|
|
|
|
|
|
|
push @definitions, {$next => $value}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my ($command, %return); |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
eval { |
|
42
|
|
|
|
|
|
|
$command = DBIx::Class::Schema::PopulateMore::Command->new( |
|
43
|
|
|
|
|
|
|
definitions=>[@definitions], |
|
44
|
|
|
|
|
|
|
schema=>$self->schema_manager->schema, |
|
45
|
|
|
|
|
|
|
exception_cb=>sub { |
|
46
|
|
|
|
|
|
|
$builder->croak(@_); |
|
47
|
|
|
|
|
|
|
}, |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
}; if ($@) { |
|
50
|
|
|
|
|
|
|
Test::More::fail("Can't create command class: $@"); |
|
51
|
|
|
|
|
|
|
} else { |
|
52
|
|
|
|
|
|
|
eval { |
|
53
|
|
|
|
|
|
|
%return = $command->execute; |
|
54
|
|
|
|
|
|
|
}; if ($@) { |
|
55
|
|
|
|
|
|
|
Test::More::fail("Can't install fixtures: $@"); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return %return; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} 1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |