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
|
|
47
|
use Moose; |
|
8
|
|
|
|
|
24
|
|
|
8
|
|
|
|
|
65
|
|
5
|
8
|
|
|
8
|
|
59260
|
use Test::PONAPI::Repository::MockDB::Table::Relationships; |
|
8
|
|
|
|
|
33
|
|
|
8
|
|
|
|
|
472
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Test::PONAPI::Repository::MockDB::Table'; |
8
|
|
|
|
|
|
|
|
9
|
8
|
|
|
|
|
1776
|
use constant COLUMNS => [qw[ |
10
|
|
|
|
|
|
|
id |
11
|
|
|
|
|
|
|
title |
12
|
|
|
|
|
|
|
body |
13
|
|
|
|
|
|
|
created |
14
|
|
|
|
|
|
|
updated |
15
|
|
|
|
|
|
|
status |
16
|
8
|
|
|
8
|
|
77
|
]]; |
|
8
|
|
|
|
|
17
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BUILDARGS { |
19
|
9
|
|
|
9
|
1
|
33
|
my $class = shift; |
20
|
9
|
50
|
|
|
|
83
|
my %args = @_ == 1 ? %{ $_[0] } : @_; |
|
0
|
|
|
|
|
0
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# We could abstract these to their own objects, but no need currently |
23
|
9
|
|
|
|
|
896
|
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
|
|
|
|
|
712
|
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
|
|
|
|
|
130
|
%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
|
|
|
|
|
681
|
return \%args; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
8
|
|
|
8
|
|
51
|
use PONAPI::Constants; |
|
8
|
|
|
|
|
18
|
|
|
8
|
|
|
|
|
2156
|
|
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
|
|
53
|
no Moose; 1; |
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
61
|
|
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.002006 |
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 |