File Coverage

blib/lib/Test/Shared/Fixture/Data/InfoBox/Address.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 1 1 100.0
total 34 34 100.0


line stmt bran cond sub pod time code
1             package Test::Shared::Fixture::Data::InfoBox::Address;
2              
3 8     8   574625 use base qw(Data::InfoBox);
  8         12  
  8         2557  
4 8     8   57 use strict;
  8         14  
  8         227  
5 8     8   40 use warnings;
  8         29  
  8         354  
6              
7 8     8   1657 use Data::Icon;
  8         333661  
  8         302  
8 8     8   2155 use Data::InfoBox::Item;
  8         22  
  8         229  
9 8     8   2152 use Data::Text::Simple;
  8         1196807  
  8         321  
10 8     8   1634 use Unicode::UTF8 qw(decode_utf8);
  8         2541  
  8         1753  
11              
12             our $VERSION = 0.07;
13              
14             sub new {
15 4     4 1 360749 my $class = shift;
16              
17 4         77 my @params = (
18             'items' => [
19             # https://vdp.cuzk.cz/vdp/ruian/adresnimista/22350799
20             Data::InfoBox::Item->new(
21             'icon' => Data::Icon->new(
22             'char' => decode_utf8('🏠'),
23             ),
24             'text' => Data::Text::Simple->new(
25             'text' => decode_utf8('Prvního pluku 211/5'),
26             ),
27             ),
28             Data::InfoBox::Item->new(
29             'text' => Data::Text::Simple->new(
30             'text' => decode_utf8('Karlín'),
31             ),
32             ),
33             Data::InfoBox::Item->new(
34             'text' => Data::Text::Simple->new(
35             'text' => '18600 Praha 8',
36             ),
37             ),
38             ],
39             );
40              
41 4         67 my $self = $class->SUPER::new(@params);
42              
43 4         46 return $self;
44             }
45              
46             1;
47              
48             __END__
49              
50             =pod
51              
52             =encoding utf8
53              
54             =head1 NAME
55              
56             Test::Shared::Fixture::Data::InfoBox::Address - Address info box fixture.
57              
58             =head1 SYNOPSIS
59              
60             use Test::Shared::Fixture::Data::InfoBox::Address;
61              
62             my $obj = Test::Shared::Fixture::Data::InfoBox::Address->new;
63             my $items_ar = $obj->items;
64              
65             =head1 METHODS
66              
67             =head2 C<new>
68              
69             my $obj = Test::Shared::Fixture::Data::InfoBox::Address->new;
70              
71             Constructor.
72              
73             Returns instance of object.
74              
75             =head2 C<items>
76              
77             my $items_ar = $obj->items;
78              
79             Get list of items in info box.
80              
81             Returns reference to array with L<Data::InfoBox::Item> objects.
82              
83             =head1 EXAMPLE
84              
85             =for comment filename=create_address_fixture_object_and_print.pl
86              
87             use strict;
88             use warnings;
89              
90             use Test::Shared::Fixture::Data::InfoBox::Address;
91             use Unicode::UTF8 qw(encode_utf8);
92              
93             my $obj = Test::Shared::Fixture::Data::InfoBox::Address->new;
94              
95             # Print out.
96             my $num = 0;
97             foreach my $item (@{$obj->items}) {
98             $num++;
99             print "Item $num: ".encode_utf8($item->text->text)."\n";
100             }
101              
102             # Output:
103             # Item 1: Prvního pluku 211/5
104             # Item 2: Karlín
105             # Item 3: 18600 Praha 8
106              
107             =head1 DEPENDENCIES
108              
109             L<Data::InfoBox>,
110             L<Data::InfoBox::Item>,
111             L<Data::Text::Simple>,
112             L<Unicode::UTF8>.
113              
114             =head1 REPOSITORY
115              
116             L<https://github.com/michal-josef-spacek/Data-InfoBox>
117              
118             =head1 AUTHOR
119              
120             Michal Josef Špaček L<mailto:skim@cpan.org>
121              
122             L<http://skim.cz>
123              
124             =head1 LICENSE AND COPYRIGHT
125              
126             © 2024-2025 Michal Josef Špaček
127              
128             BSD 2-Clause License
129              
130             =head1 VERSION
131              
132             0.07
133              
134             =cut