SD/Model/Attachment.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 35 CC 2 SCAR 11.5
CC
2
Cov
0%
create
6.0
_default_summary_format
2.0
BEGIN
2.0
CRAP 3.1
1 package App::SD::Model::Attachment;
2 use Any::Moose;
3 extends 'App::SD::Record';
4 use Params::Validate qw/validate/;
5  
6 use constant collection_class => 'App::SD::Collection::Attachment';
7 has '+type' => ( default => 'attachment');
8  
9  
10 sub _default_summary_format { '%s,$luid | %s,name | %s,content_type'}
11  
12 __PACKAGE__->register_reference( ticket => 'App::SD::Model::Ticket');
13  
14 sub create {
15 my $self = shift;
16 my %args = validate( @_, {props => 1});
17  
18  
19 return (0,"You can't create an attachment without specifying a 'ticket' uuid") unless ($args{'props'}->{'ticket'});
20  
21 $args{'props'}->{'content_type'} ||= 'text/plain'; # XXX TODO use real mime typing;
22
23  
24 $self->SUPER::create(%args);
25 }
26  
27 __PACKAGE__->meta->make_immutable;
28 no Any::Moose;
29  
30 1;