Silki/Schema/Country.pm

filter: Statementstmt 83.3% 25 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 76.9% 30 / 39 CC 3 SCAR 16.3
CC
3
Cov
78%
CreateDefaultCountries
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
« Silki/Exceptions.pm ↑ Summary Silki/Controller/File.pm »
1 package Silki::Schema::Country;
2 {
3 1 $Silki::Schema::Country::VERSION = '0.29';
4 }
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Silki::Schema;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Fey::ORM::Table;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 my $Schema = Silki::Schema->Schema();
15  
16 {
17 1 has_policy 'Silki::Schema::Policy';
18  
19 1 has_table( $Schema->table('Country') );
20  
21 1 has_one( $Schema->table('Locale') );
22  
23 1 has_many time_zones => (
24 table => $Schema->table('TimeZone'),
25 order_by =>
26 [ $Schema->table('TimeZone')->column('display_order'), 'ASC' ],
27 );
28 }
29  
30 0 ▶sub CreateDefaultCountries {
Subroutine CreateDefaultCountries: not called CC=3 SCAR=24.8
Pod undocumented
31 0 my $class = shift;
32  
33 0 my @countries = (
34 [ 'us', 'United States', 'en_US' ],
35 [ 'ca', 'Canada', 'en_CA' ],
36 );
37  
38 0 for my $country (@countries) {
39 0 ▶ next if $class->new( iso_code => $country->[0] );
Branch: 1 branch
BranchTrueFalseTotal
if $class->new("iso_code", $country->[0]) 0 0 0
40  
41 0 $class->insert(
42 iso_code => $country->[0],
43 name => $country->[1],
44 locale_code => $country->[2],
45 );
46 }
47 }
48  
49 1 __PACKAGE__->meta()->make_immutable();
50  
51 1 1;
52  
53 # ABSTRACT: Represents a country
54  
55 __END__
« Silki/Exceptions.pm ↑ Summary Silki/Controller/File.pm »