| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# ABSTRACT: mock repository - table - Articles |
|
2
|
|
|
|
|
|
|
package Test::PONAPI::Repository::MockDB::Table::Articles; |
|
3
|
|
|
|
|
|
|
|
|
4
|
8
|
|
|
8
|
|
50
|
use Moose; |
|
|
8
|
|
|
|
|
18
|
|
|
|
8
|
|
|
|
|
67
|
|
|
5
|
8
|
|
|
8
|
|
59367
|
use Test::PONAPI::Repository::MockDB::Table::Relationships; |
|
|
8
|
|
|
|
|
32
|
|
|
|
8
|
|
|
|
|
516
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Test::PONAPI::Repository::MockDB::Table'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
8
|
|
|
|
|
1729
|
use constant COLUMNS => [qw[ |
|
10
|
|
|
|
|
|
|
id |
|
11
|
|
|
|
|
|
|
title |
|
12
|
|
|
|
|
|
|
body |
|
13
|
|
|
|
|
|
|
created |
|
14
|
|
|
|
|
|
|
updated |
|
15
|
|
|
|
|
|
|
status |
|
16
|
8
|
|
|
8
|
|
84
|
]]; |
|
|
8
|
|
|
|
|
20
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BUILDARGS { |
|
19
|
9
|
|
|
9
|
1
|
25
|
my $class = shift; |
|
20
|
9
|
50
|
|
|
|
59
|
my %args = @_ == 1 ? %{ $_[0] } : @_; |
|
|
0
|
|
|
|
|
0
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# We could abstract these to their own objects, but no need currently |
|
23
|
9
|
|
|
|
|
618
|
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
|
|
|
|
|
570
|
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
|
|
|
|
|
98
|
%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
|
|
|
|
|
492
|
return \%args; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
8
|
|
|
8
|
|
52
|
use PONAPI::Constants; |
|
|
8
|
|
|
|
|
98
|
|
|
|
8
|
|
|
|
|
2700
|
|
|
58
|
|
|
|
|
|
|
override update_stmt => sub { |
|
59
|
|
|
|
|
|
|
my ($self, %args) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $values = $args{values} || {}; |
|
62
|
|
|
|
|
|
|
my $copy = { %$values }; |
|
63
|
|
|
|
|
|
|
$copy->{updated} = \'CURRENT_TIMESTAMP'; |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my ($stmt, $ret, $msg) = $self->SUPER::update_stmt(%args, values => $copy); |
|
66
|
|
|
|
|
|
|
$ret ||= PONAPI_UPDATED_EXTENDED; |
|
67
|
|
|
|
|
|
|
return $stmt, $ret, $msg; |
|
68
|
|
|
|
|
|
|
}; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
71
|
8
|
|
|
8
|
|
55
|
no Moose; 1; |
|
|
8
|
|
|
|
|
21
|
|
|
|
8
|
|
|
|
|
62
|
|
|
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.002005 |
|
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 |