Test/PONAPI/Repository/MockDB/Table/Articles.pm

filter: Statementstmt 96.9% 32 / 33 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 87.7% 43 / 49 CC 4 SCAR 6.0
CC
4
Cov
90%
__ANON__
3.1
BUILDARGS
2.0
BEGIN
1.0
CRAP 1.8
« PONAPI/Builder/Links.pm ↑ Summary PONAPI/Builder/Resource/Identifier.pm »
1 # ABSTRACT: mock repository - table - Articles
2 package Test::PONAPI::Repository::MockDB::Table::Articles;
3  
4 8 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 8 ▶use Test::PONAPI::Repository::MockDB::Table::Relationships;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 8 extends 'Test::PONAPI::Repository::MockDB::Table';
8  
9 8 use constant COLUMNS => [qw[
10 id
11 title
12 body
13 created
14 updated
15 status
16 8 ▶]];
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 sub BUILDARGS {
19 9 ▶ my $class = shift;
Subroutine BUILDARGS: called CC=2 SCAR=7.1
Pod documented
20 9 ▶ my %args = @_ == 1 ? %{ $_[0] } : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 0 9 9
21  
22 # We could abstract these to their own objects, but no need currently
23 9 my $to_comments =
24 Test::PONAPI::Repository::MockDB::Table::Relationships->new(
25 TYPE => 'comments',
26 TABLE => 'rel_articles_comments',
27 ID_COLUMN => 'id_articles',
28 REL_ID_COLUMN => 'id_comments',
29 COLUMNS => [qw/ id_articles id_comments /],
30 ONE_TO_ONE => 0,
31 );
32 9 my $to_authors =
33 Test::PONAPI::Repository::MockDB::Table::Relationships->new(
34 TYPE => 'people',
35 TABLE => 'rel_articles_people',
36 ID_COLUMN => 'id_articles',
37 REL_ID_COLUMN => 'id_people',
38 COLUMNS => [qw/ id_articles id_people /],
39 ONE_TO_ONE => 1,
40 );
41  
42 9 %args = (
43 TYPE => 'articles',
44 TABLE => 'articles',
45 ID_COLUMN => 'id',
46 COLUMNS => COLUMNS(),
47 RELATIONS => {
48 authors => $to_authors,
49 comments => $to_comments,
50 },
51 %args,
52 );
53  
54 9 return \%args;
55 }
56  
57 8 ▶use PONAPI::Constants;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 override update_stmt => sub {
59 7 ▶ my ($self, %args) = @_;
Subroutine __ANON__: called CC=3 SCAR=11.2
60  
61 7 ▶ my $values = $args{values} || {};
Condition50%1/2
$args{'values'} || {}
l!l
70
MC/DC0%0/1
$args{'values'} || {}
$args{'values'}
Truth table50%1/2
A
A= $args{'values'}
Aresult
11
00
62 7 my $copy = { %$values };
63 7 $copy->{updated} = \'CURRENT_TIMESTAMP';
64  
65 7 my ($stmt, $ret, $msg) = $self->SUPER::update_stmt(%args, values => $copy);
66 7 ▶ $ret ||= PONAPI_UPDATED_EXTENDED;
Condition50%1/2
$ret ||= 100
l!l
07
MC/DC0%0/1
$ret ||= 100
$ret
Truth table50%1/2
A
A= $ret
Aresult
11
00
67 7 return $stmt, $ret, $msg;
68 8 };
69  
70 8 __PACKAGE__->meta->make_immutable;
71 8 ▶no Moose; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
72  
73 __END__
74  
75 =pod
76  
77 =encoding UTF-8
78  
79 =head1 NAME
80  
81 Test::PONAPI::Repository::MockDB::Table::Articles - mock repository - table - Articles
82  
83 =head1 VERSION
84  
85 version 0.002012
86  
87 =head1 AUTHORS
88  
89 =over 4
90  
91 =item *
92  
93 Mickey Nasriachi <mickey@cpan.org>
94  
95 =item *
96  
97 Stevan Little <stevan@cpan.org>
98  
99 =item *
100  
101 Brian Fraser <hugmeir@cpan.org>
102  
103 =back
104  
105 =head1 COPYRIGHT AND LICENSE
106  
107 This software is copyright (c) 2016 by Mickey Nasriachi, Stevan Little, Brian Fraser.
108  
109 This is free software; you can redistribute it and/or modify it under
110 the same terms as the Perl 5 programming language system itself.
111  
112 =cut
« PONAPI/Builder/Links.pm ↑ Summary PONAPI/Builder/Resource/Identifier.pm »