blib/lib/DBIO/Test/Schema/Track.pm

filter: Statementstmt 76.9% 30 / 39 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 1 totaltotal 57.6% 34 / 59 CC 6 SCAR 19.3
CC
6
Cov
61%
__ANON__
12.0
sqlt_deploy_hook
12.0
__ANON__
6.0
CRAP 6.9
« blib/lib/DBIO/Diff/Base.pm ↑ Summary blib/lib/DBIO/Candy.pm »
1 package DBIO::Test::Schema::Track;
2 # ABSTRACT: Test result class for the track table
3  
4 256 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 256 our $VERSION = '0.900007';
7  
8 256 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 256 ▶use base 'DBIO::Test::BaseResult';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 256 ▶use DBIO::Test::Util 'check_customcond_args';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 256 __PACKAGE__->load_components(qw{
14 +DBIO::Test::DeployComponent
15 InflateColumn::DateTime
16 Ordered
17 });
18  
19 256 __PACKAGE__->table('track');
20 256 __PACKAGE__->add_columns(
21 'trackid' => {
22 data_type => 'integer',
23 is_auto_increment => 1,
24 },
25 'cd' => {
26 data_type => 'integer',
27 grouping => 1,
28 },
29 'position' => {
30 data_type => 'int',
31 accessor => 'pos',
32 position => 1,
33 },
34 'title' => {
35 data_type => 'varchar',
36 size => 100,
37 },
38 last_updated_on => {
39 data_type => 'datetime',
40 accessor => 'updated_date',
41 is_nullable => 1
42 },
43 last_updated_at => {
44 data_type => 'datetime',
45 is_nullable => 1
46 },
47 );
48 256 __PACKAGE__->set_primary_key('trackid');
49  
50 256 __PACKAGE__->add_unique_constraint([ qw/cd position/ ]);
51 256 __PACKAGE__->add_unique_constraint([ qw/cd title/ ]);
52  
53 # the undef condition in this rel is *deliberate*
54 # tests oddball legacy syntax
55 256 __PACKAGE__->belongs_to( cd => 'DBIO::Test::Schema::CD', undef, {
56 proxy => { cd_title => 'title' },
57 });
58 # custom condition coderef
59 __PACKAGE__->belongs_to( cd_cref_cond => 'DBIO::Test::Schema::CD',
60 0 ▶sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
61 # This is for test purposes only. A regular user does not
62 # need to sanity check the passed-in arguments, this is what
63 # the tests are for :)
64 0 my $args = &check_customcond_args;
65  
66 return (
67 {
68 "$args->{foreign_alias}.cdid" => { -ident => "$args->{self_alias}.cd" },
69 },
70  
71 ! $args->{self_result_object} ? () : {
72 "$args->{foreign_alias}.cdid" => $args->{self_result_object}->get_column('cd')
73 },
74  
75 ! $args->{foreign_values} ? () : {
76 "$args->{self_alias}.cd" => $args->{foreign_values}{cdid}
77 },
78 0 ▶ );
Branch: 2 branches
BranchTrueFalseTotal
!$args->{'self_result_object'} ? : 0 0 0
!$args->{'foreign_values'} ? : 0 0 0
79 }
80 256 );
81 256 __PACKAGE__->belongs_to( disc => 'DBIO::Test::Schema::CD' => 'cd', {
82 proxy => 'year'
83 });
84  
85 256 __PACKAGE__->might_have( cd_single => 'DBIO::Test::Schema::CD', 'single_track' );
86 256 __PACKAGE__->might_have( lyrics => 'DBIO::Test::Schema::Lyrics', 'track_id' );
87  
88 256 __PACKAGE__->belongs_to(
89 "year1999cd",
90 "DBIO::Test::Schema::Year1999CDs",
91 'cd',
92 { join_type => 'left' }, # the relationship is of course optional
93 );
94 256 __PACKAGE__->belongs_to(
95 "year2000cd",
96 "DBIO::Test::Schema::Year2000CDs",
97 'cd',
98 { join_type => 'left' },
99 );
100  
101 __PACKAGE__->has_many (
102 next_tracks => __PACKAGE__,
103 0 ▶ sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
104 # This is for test purposes only. A regular user does not
105 # need to sanity check the passed-in arguments, this is what
106 # the tests are for :)
107 0 my $args = &check_customcond_args;
108  
109 return (
110 { "$args->{foreign_alias}.cd" => { -ident => "$args->{self_alias}.cd" },
111 "$args->{foreign_alias}.position" => { '>' => { -ident => "$args->{self_alias}.position" } },
112 },
113 $args->{self_result_object} && {
114 "$args->{foreign_alias}.cd" => $args->{self_result_object}->get_column('cd'),
115 "$args->{foreign_alias}.position" => { '>' => $args->{self_result_object}->pos },
116 }
117 )
118 0 ▶ }
Condition0%0/2
$args->{'self_result_object'} && {"$args->{'foreign_alias'}.cd", $args->{'self_result_object'}->get_column('cd'), "$args->{'foreign_alias'}.position", {'>', $args->{'self_result_object'}->pos}}
!ll
00
MC/DC0%0/1
$args->{'self_result_object'} && {"$args->{'foreign_alias'}.cd", $args->{'self_result_object'}->get_column('cd'), "$args->{'foreign_alias'}.position", {'>', $args->{'self_result_object'}->pos}}
$args->{'self_result_object'}
Truth table0%0/2
A
A= $args->{'self_result_object'}
Aresult
00
11
119 256 );
120  
121 __PACKAGE__->has_many (
122 deliberately_broken_all_cd_tracks => __PACKAGE__,
123 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
124 # This is for test purposes only. A regular user does not
125 # need to sanity check the passed-in arguments, this is what
126 # the tests are for :)
127 0 my $args = &check_customcond_args;
128  
129 return {
130 0 "$args->{foreign_alias}.cd" => "$args->{self_alias}.cd"
131 };
132 }
133 256 );
134  
135 256 our $hook_cb;
136  
137 0 ▶sub sqlt_deploy_hook {
Subroutine sqlt_deploy_hook: not called CC=3 SCAR=24.8
Pod undocumented
138 0 my $class = shift;
139  
140 0 ▶ $hook_cb->($class, @_) if $hook_cb;
Branch: 1 branch
BranchTrueFalseTotal
if $DBIO::Test::Schema::Track::hook_cb 0 0 0
141 0 ▶ $class->next::method(@_) if $class->next::can;
Branch: 1 branch
BranchTrueFalseTotal
if $class->next::can 0 0 0
142 }
143  
144 256 1;
145  
146 __END__
« blib/lib/DBIO/Diff/Base.pm ↑ Summary blib/lib/DBIO/Candy.pm »