Silki/Controller/UserImage.pm untested

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 55 CC 2 SCAR 10.0
CC
2
Cov
0%
_set_image
6.0
BEGIN
2.0
small_image
2.0
CRAP 2.7
1 package Silki::Controller::UserImage;
2 {
3 $Silki::Controller::UserImage::VERSION = '0.29';
4 }
5  
6 use strict;
7 use warnings;
8 use namespace::autoclean;
9  
10 use Silki::Schema::UserImage;
11  
12 use Moose;
13  
14 BEGIN { extends 'Silki::Controller::Base' }
15  
16 with 'Silki::Role::Controller::File';
17  
18 sub _set_image : Chained('/') : PathPart('user_image') : CaptureArgs(1) {
19 my $self = shift;
20 my $c = shift;
21 my $user_id = shift;
22  
23 my $image = Silki::Schema::UserImage->new( user_id => $user_id );
24  
25 $c->status_not_found()
26 unless $image;
27  
28 $c->stash()->{image} = $image;
29 }
30  
31 sub small_image : Chained('_set_image') : PathPart('small') : Args(0) {
32 my $self = shift;
33 my $c = shift;
34 my $user_id = shift;
35  
36 $self->_serve_image( $c, $c->stash()->{image}, 'small_image_file' );
37 }
38  
39 sub thumbnail : Chained('_set_image') : PathPart('thumbnail') : Args(0) {
40 my $self = shift;
41 my $c = shift;
42 my $user_id = shift;
43  
44 $self->_serve_image( $c, $c->stash()->{image}, 'thumbnail_file' );
45 }
46  
47 sub mini_image : Chained('_set_image') : PathPart('mini') : Args(0) {
48 my $self = shift;
49 my $c = shift;
50 my $user_id = shift;
51  
52 $self->_serve_image( $c, $c->stash()->{image}, 'mini_image_file' );
53 }
54  
55 __PACKAGE__->meta()->make_immutable();
56  
57 1;