File Coverage

blib/lib/Test/Shared/Fixture/Wikibase/Datatype/Item/Wikidata/Dog.pm
Criterion Covered Total %
statement 31 31 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 1 1 100.0
total 42 42 100.0


line stmt bran cond sub pod time code
1             package Test::Shared::Fixture::Wikibase::Datatype::Item::Wikidata::Dog;
2              
3 3     3   349306 use base qw(Wikibase::Datatype::Item);
  3         34  
  3         1558  
4 3     3   22 use strict;
  3         7  
  3         100  
5 3     3   17 use warnings;
  3         10  
  3         74  
6              
7 3     3   1549 use Test::Shared::Fixture::Wikibase::Datatype::Statement::Wikidata::InstanceOf::CommonLivingOrganism;
  3         8  
  3         102  
8 3     3   1418 use Unicode::UTF8 qw(decode_utf8);
  3         1566  
  3         158  
9 3     3   1171 use Wikibase::Datatype::Sitelink;
  3         9  
  3         83  
10 3     3   20 use Wikibase::Datatype::Statement;
  3         8  
  3         62  
11 3     3   17 use Wikibase::Datatype::Value::Item;
  3         7  
  3         71  
12 3     3   16 use Wikibase::Datatype::Value::Monolingual;
  3         7  
  3         896  
13              
14             our $VERSION = 0.29;
15              
16             sub new {
17 1     1 1 126 my $class = shift;
18              
19 1         19 my @params = (
20             'aliases' => [
21             Wikibase::Datatype::Value::Monolingual->new(
22             'language' => 'cs',
23             'value' => decode_utf8('pes domácí'),
24             ),
25             Wikibase::Datatype::Value::Monolingual->new(
26             'language' => 'en',
27             'value' => 'domestic dog',
28             ),
29             Wikibase::Datatype::Value::Monolingual->new(
30             'language' => 'en',
31             'value' => 'Canis lupus familiaris',
32             ),
33             Wikibase::Datatype::Value::Monolingual->new(
34             'language' => 'en',
35             'value' => 'Canis familiaris',
36             ),
37             Wikibase::Datatype::Value::Monolingual->new(
38             'language' => 'en',
39             'value' => 'dogs',
40             ),
41             Wikibase::Datatype::Value::Monolingual->new(
42             'language' => 'en',
43             'value' => decode_utf8('🐶'),
44             ),
45             Wikibase::Datatype::Value::Monolingual->new(
46             'language' => 'en',
47             'value' => decode_utf8('🐕'),
48             ),
49             ],
50             'descriptions' => [
51             Wikibase::Datatype::Value::Monolingual->new(
52             'language' => 'cs',
53             'value' => decode_utf8('domácí zvíře'),
54             ),
55             Wikibase::Datatype::Value::Monolingual->new(
56             'language' => 'en',
57             'value' => 'domestic animal',
58             ),
59             ],
60             'labels' => [
61             Wikibase::Datatype::Value::Monolingual->new(
62             'language' => 'cs',
63             'value' => 'pes',
64             ),
65             Wikibase::Datatype::Value::Monolingual->new(
66             'language' => 'en',
67             'value' => 'dog',
68             ),
69             ],
70             'id' => 'Q144',
71             'lastrevid' => 1539465460,
72             'modified' => '2021-12-06T14:48:31Z',
73             'ns' => 0,
74             'page_id' => 280,
75             'sitelinks' => [
76             Wikibase::Datatype::Sitelink->new(
77             'site' => 'enwiki',
78             'title' => 'Dog',
79             ),
80             ],
81             'statements' => [
82             Test::Shared::Fixture::Wikibase::Datatype::Statement::Wikidata::InstanceOf::CommonLivingOrganism->new,
83             ],
84             'title' => 'Q144',
85             );
86              
87 1         9 my $self = $class->SUPER::new(@params);
88              
89 1         21 return $self;
90             }
91              
92             1;
93              
94             __END__
95              
96             =pod
97              
98             =encoding utf8
99              
100             =head1 NAME
101              
102             Test::Shared::Fixture::Wikibase::Datatype::Item::Wikidata::Dog - Test instance for Wikidata item.
103              
104             =head1 SYNOPSIS
105              
106             use Test::Shared::Fixture::Wikibase::Datatype::Item::Wikidata::Dog;
107              
108             my $obj = Test::Shared::Fixture::Wikibase::Datatype::Item::Wikidata::Dog->new;
109             my $aliases_ar = $obj->aliases;
110             my $descriptions_ar = $obj->descriptions;
111             my $id = $obj->id;
112             my $labels_ar = $obj->labels;
113             my $lastrevid = $obj->lastrevid;
114             my $modified = $obj->modified;
115             my $ns = $obj->ns;
116             my $page_id = $obj->page_id;
117             my $sitelinks_ar = $obj->sitelinks;
118             my $statements_ar = $obj->statements;
119             my $title = $obj->title;
120              
121             =head1 METHODS
122              
123             =head2 C<new>
124              
125             my $obj = Test::Shared::Fixture::Wikibase::Datatype::Item::Wikidata::Dog->new;
126              
127             Constructor.
128              
129             Returns instance of object.
130              
131             =head2 C<aliases>
132              
133             my $aliases_ar = $obj->aliases;
134              
135             Get aliases.
136              
137             Returns reference to array with Wikibase::Datatype::Value::Monolingual instances.
138              
139             =head2 C<descriptions>
140              
141             my $descriptions_ar = $obj->descriptions;
142              
143             Get descriptions.
144              
145             Returns reference to array with Wikibase::Datatype::Value::Monolingual instances.
146              
147             =head2 C<id>
148              
149             my $id = $obj->id;
150              
151             Get id.
152              
153             Returns string.
154              
155             =head2 C<labels>
156              
157             my $labels_ar = $obj->labels;
158              
159             Get labels.
160              
161             Returns reference to array with Wikibase::Datatype::Value::Monolingual instances.
162              
163             =head2 C<lastrevid>
164              
165             my $lastrevid = $obj->lastrevid;
166              
167             Get last revision ID.
168              
169             Returns string.
170              
171             =head2 C<modified>
172              
173             my $modified = $obj->modified;
174              
175             Get date of modification.
176              
177             Returns string.
178              
179             =head2 C<ns>
180              
181             my $ns = $obj->ns;
182              
183             Get namespace.
184              
185             Returns number.
186              
187             =head2 C<page_id>
188              
189             my $page_id = $obj->page_id;
190              
191             Get page id.
192              
193             Returns number.
194              
195             =head2 C<sitelinks>
196              
197             my $sitelinks_ar = $obj->sitelinks;
198              
199             Get sitelinks.
200              
201             Returns reference to array with Wikibase::Datatype::Sitelink instances.
202              
203             =head2 C<statements>
204              
205             my $statements_ar = $obj->statements;
206              
207             Get statements.
208              
209             Returns reference to array with Wikibase::Datatype::Statement instances.
210              
211             =head2 C<title>
212              
213             my $title = $obj->title;
214              
215             Get title.
216              
217             Returns string.
218              
219             =head1 EXAMPLE
220              
221             =for comment filename=fixture_create_and_print_item_wd_dog.pl
222              
223             use strict;
224             use warnings;
225              
226             use Test::Shared::Fixture::Wikibase::Datatype::Item::Wikidata::Dog;
227             use Unicode::UTF8 qw(encode_utf8);
228             use Wikibase::Datatype::Print::Item;
229              
230             # Object.
231             my $obj = Test::Shared::Fixture::Wikibase::Datatype::Item::Wikidata::Dog->new;
232              
233             # Print out.
234             print encode_utf8(scalar Wikibase::Datatype::Print::Item::print($obj));
235              
236             # Output:
237             # Label: dog (en)
238             # Description: domestic animal (en)
239             # Aliases:
240             # domestic dog (en)
241             # Canis lupus familiaris (en)
242             # Canis familiaris (en)
243             # dogs (en)
244             # 🐶 (en)
245             # 🐕 (en)
246             # Sitelinks:
247             # Dog (enwiki)
248             # Statements:
249             # P31: Q55983715 (normal)
250             # P642: Q20717272
251             # P642: Q26972265
252              
253             =head1 DEPENDENCIES
254              
255             L<Test::Shared::Fixture::Wikibase::Datatype::Statement::Wikidata::InstanceOf::CommonLivingOrganism>,
256             L<Unicode::UTF8>,
257             L<Wikibase::Datatype::Sitelink>,
258             L<Wikibase::Datatype::Statement>,
259             L<Wikibase::Datatype::Snak>,
260             L<Wikibase::Datatype::Value::Item>,
261             L<Wikibase::Datatype::Value::Monolingual>.
262              
263             =head1 SEE ALSO
264              
265             =over
266              
267             =item L<Wikibase::Datatype>
268              
269             Wikibase datatypes.
270              
271             =item L<Wikibase::Datatype::Item>
272              
273             Wikibase item datatype.
274              
275             =back
276              
277             =head1 REPOSITORY
278              
279             L<https://github.com/michal-josef-spacek/Wikibase-Datatype>
280              
281             =head1 AUTHOR
282              
283             Michal Josef Špaček L<mailto:skim@cpan.org>
284              
285             L<http://skim.cz>
286              
287             =head1 LICENSE AND COPYRIGHT
288              
289             © 2020-2023 Michal Josef Špaček
290              
291             BSD 2-Clause License
292              
293             =head1 VERSION
294              
295             0.29
296              
297             =cut