blib/lib/Parcel/Track/Test.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 20 | 22 | 90.9 |
branch | 1 | 2 | 50.0 |
condition | n/a | ||
subroutine | 7 | 7 | 100.0 |
pod | 3 | 4 | 75.0 |
total | 31 | 35 | 88.5 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Parcel::Track::Test; | ||||||
2 | # ABSTRACT: Parcel::Track driver for the Regional-Class Test | ||||||
3 | |||||||
4 | 3 | 3 | 3718 | use utf8; | |||
3 | 25 | ||||||
3 | 10 | ||||||
5 | |||||||
6 | 3 | 3 | 92 | use Moo; | |||
3 | 5 | ||||||
3 | 16 | ||||||
7 | |||||||
8 | our $VERSION = '0.005'; | ||||||
9 | |||||||
10 | with 'Parcel::Track::Role::Base'; | ||||||
11 | |||||||
12 | 3 | 3 | 2548 | use Encode qw( encode_utf8 ); | |||
3 | 23305 | ||||||
3 | 1097 | ||||||
13 | |||||||
14 | has foo => ( is => 'ro' ); | ||||||
15 | has bar => ( is => 'ro' ); | ||||||
16 | |||||||
17 | our $URI = 'http://test?tracking_number=%s'; | ||||||
18 | |||||||
19 | sub BUILDARGS { | ||||||
20 | 3 | 3 | 0 | 2443 | my ( $class, @args ) = @_; | ||
21 | |||||||
22 | 3 | 4 | my %params; | ||||
23 | 3 | 50 | 8 | if ( ref $args[0] eq 'HASH' ) { | |||
24 | 0 | 0 | %params = %{ $args[0] }; | ||||
0 | 0 | ||||||
25 | } | ||||||
26 | else { | ||||||
27 | 3 | 10 | %params = @args; | ||||
28 | } | ||||||
29 | 3 | 15 | $params{id} =~ s/\D//g; | ||||
30 | |||||||
31 | 3 | 105 | return \%params; | ||||
32 | } | ||||||
33 | |||||||
34 | 1 | 1 | 1 | 1349 | sub uri { sprintf( $URI, $_[0]->id ) } | ||
35 | |||||||
36 | sub track { | ||||||
37 | 1 | 1 | 1 | 2 | my $self = shift; | ||
38 | |||||||
39 | 1 | 5 | my %result = ( | ||||
40 | from => encode_utf8(q{Keedi Kim}), | ||||||
41 | to => encode_utf8(q{CPAN}), | ||||||
42 | result => encode_utf8(q{2015.01.27 Shipping Completed}), | ||||||
43 | htmls => [ | ||||||
44 | encode_utf8(q{ dummy 1 }), encode_utf8(q{dummy 2 }), |
||||||
45 | encode_utf8(q{ dummy 3 }), |
||||||
46 | ], | ||||||
47 | descs => [ | ||||||
48 | encode_utf8(q{2015.01.24. 17:34 Receipt}), | ||||||
49 | encode_utf8(q{2015.01.25. 09:00 Gwangjin Branch}), | ||||||
50 | encode_utf8(q{2015.01.25. 13:01 Loading}), | ||||||
51 | encode_utf8(q{2015.01.26. 15:23 Unloading}), | ||||||
52 | encode_utf8(q{2015.01.27. 10:45 Gangdong Branch}), | ||||||
53 | encode_utf8(q{2015.01.27. 16:13 Shipping Completed}), | ||||||
54 | ], | ||||||
55 | ); | ||||||
56 | |||||||
57 | 1 | 38 | return \%result; | ||||
58 | } | ||||||
59 | |||||||
60 | 1 | 1 | 1 | 398 | sub clear { 1 } | ||
61 | |||||||
62 | 1; | ||||||
63 | |||||||
64 | # | ||||||
65 | # This file is part of Parcel-Track | ||||||
66 | # | ||||||
67 | # This software is copyright (c) 2015 by Keedi Kim. | ||||||
68 | # | ||||||
69 | # This is free software; you can redistribute it and/or modify it under | ||||||
70 | # the same terms as the Perl 5 programming language system itself. | ||||||
71 | # | ||||||
72 | |||||||
73 | __END__ |