| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::DBIx::Class::FixtureCommand::PopulateMore; { |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2654
|
use Moose; |
|
|
4
|
|
|
|
|
8
|
|
|
|
4
|
|
|
|
|
32
|
|
|
4
|
4
|
|
|
4
|
|
18312
|
use Test::More (); |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
77
|
|
|
5
|
4
|
|
|
4
|
|
1029
|
use DBIx::Class::Schema::PopulateMore::Command; |
|
|
4
|
|
|
|
|
252457
|
|
|
|
4
|
|
|
|
|
56
|
|
|
6
|
|
|
|
|
|
|
with 'Test::DBIx::Class::Role::FixtureCommand'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub install_fixtures { |
|
9
|
5
|
|
|
5
|
1
|
19
|
my ($self, $arg, @rest) = @_; |
|
10
|
5
|
|
|
|
|
178
|
my $builder = $self |
|
11
|
|
|
|
|
|
|
->schema_manager |
|
12
|
|
|
|
|
|
|
->builder; |
|
13
|
|
|
|
|
|
|
|
|
14
|
5
|
50
|
|
|
|
17
|
$builder->croak("Argument is required.") |
|
15
|
|
|
|
|
|
|
unless $arg; |
|
16
|
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
8
|
my @args; |
|
18
|
5
|
50
|
66
|
|
|
65
|
if(ref $arg && ref $arg eq 'ARRAY') { |
|
|
|
100
|
66
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
@args = @$arg; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
elsif(ref $arg && ref $arg eq 'HASH') { |
|
22
|
2
|
|
|
|
|
19
|
@args = %$arg; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
else { |
|
25
|
3
|
|
|
|
|
6
|
@args = ($arg, @rest); |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
5
|
|
|
|
|
6
|
my @definitions; |
|
29
|
5
|
|
|
|
|
16
|
while(@args) { |
|
30
|
10
|
|
|
|
|
12
|
my $next = shift(@args); |
|
31
|
10
|
50
|
33
|
|
|
29
|
if( (ref $next) && (ref $next eq 'HASH') ) { |
|
32
|
0
|
|
|
|
|
0
|
push @definitions, $next; |
|
33
|
|
|
|
|
|
|
} else { |
|
34
|
10
|
|
|
|
|
12
|
my $value = shift(@args); |
|
35
|
10
|
|
|
|
|
28
|
push @definitions, {$next => $value}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
5
|
|
|
|
|
14
|
my ($command, %return); |
|
40
|
|
|
|
|
|
|
|
|
41
|
5
|
|
|
|
|
8
|
eval { |
|
42
|
|
|
|
|
|
|
$command = DBIx::Class::Schema::PopulateMore::Command->new( |
|
43
|
|
|
|
|
|
|
definitions=>[@definitions], |
|
44
|
|
|
|
|
|
|
schema=>$self->schema_manager->schema, |
|
45
|
|
|
|
|
|
|
exception_cb=>sub { |
|
46
|
0
|
|
|
0
|
|
0
|
$builder->croak(@_); |
|
47
|
|
|
|
|
|
|
}, |
|
48
|
5
|
|
|
|
|
153
|
); |
|
49
|
5
|
50
|
|
|
|
12287
|
}; if ($@) { |
|
50
|
0
|
|
|
|
|
0
|
Test::More::fail("Can't create command class: $@"); |
|
51
|
|
|
|
|
|
|
} else { |
|
52
|
5
|
|
|
|
|
10
|
eval { |
|
53
|
5
|
|
|
|
|
27
|
%return = $command->execute; |
|
54
|
5
|
50
|
|
|
|
4587757
|
}; if ($@) { |
|
55
|
0
|
|
|
|
|
0
|
Test::More::fail("Can't install fixtures: $@"); |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
|
|
59
|
5
|
|
|
|
|
47
|
return %return; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
} 1; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 NAME |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Test::DBIx::Class::FixtureCommand::PopulateMore - Install fixtures using PopulateMore |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $command = Test::DBIx::Class::FixtureComand::PopulateMore->new(schema=>$schema); |
|
72
|
|
|
|
|
|
|
$command->install_fixtures($fixtures); |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This uses the L<DBIx::Class::Schema::PopulateMore> to install fixtures. Please |
|
77
|
|
|
|
|
|
|
review the documentation for that module for more. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 METHODS |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This class defines the following methods |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 install_fixtures |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Takes an Array or ArrayRef of arguments and installs them into your target |
|
86
|
|
|
|
|
|
|
database. Returns as L<DBIx::Class::Schema::PopulateMore>. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
John Napiorkowski C<< <jjnapiork@cpan.org> >> |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Copyright 2009, John Napiorkowski C<< <jjnapiork@cpan.org> >> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
|
97
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |