Faker/Plugin/Address.pm untested

filter: Statementstmt 0.0% 0 / 55 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod n/a totaltotal 0.0% 0 / 62 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Faker::Plugin::Address;
2  
3 use 5.014;
4  
5 use strict;
6 use warnings;
7  
8 use registry;
9 use routines;
10  
11 use Data::Object::Class;
12 use Data::Object::ClassHas;
13  
14 extends 'Data::Object::Plugin';
15  
16 our $VERSION = '1.03'; # VERSION
17  
18 # ATTRIBUTES
19  
20 has 'faker' => (
21 is => 'ro',
22 isa => 'ConsumerOf["Faker::Maker"]',
23 req => 1,
24 );
25  
26 # METHODS
27  
28 method data_for_number() {
29 [
30 '%',
31 '%%',
32 '%%%%',
33 ]
34 }
35  
36 method data_for_city_prefix() {
37 [
38 'North',
39 'East',
40 'West',
41 'South',
42 'New',
43 'Lake',
44 'Port',
45 ]
46 }
47  
48 method data_for_city_suffix() {
49 [
50 'town',
51 'ton',
52 'land',
53 'ville',
54 'berg',
55 'burgh',
56 'borough',
57 'bury',
58 'view',
59 'port',
60 'mouth',
61 'stad',
62 'furt',
63 'chester',
64 'mouth',
65 'fort',
66 'haven',
67 'side',
68 'shire',
69 'burg',
70 'ford',
71 'town',
72 'ville',
73 ]
74 }
75  
76 method data_for_country_name() {
77 [
78 'Afghanistan',
79 'Albania',
80 'Algeria',
81 'American Samoa',
82 'Andorra',
83 'Angola',
84 'Anguilla',
85 'Antarctica',
86 'Antigua and Barbuda',
87 'Argentina',
88 'Armenia',
89 'Aruba',
90 'Australia',
91 'Austria',
92 'Azerbaijan',
93 'Bahamas',
94 'Bahrain',
95 'Bangladesh',
96 'Barbados',
97 'Belarus',
98 'Belgium',
99 'Belize',
100 'Benin',
101 'Bermuda',
102 'Bhutan',
103 'Bolivia',
104 'Bosnia and Herzegovina',
105 'Botswana',
106 'Bouvet Island',
107 'Brazil',
108 'British Indian Ocean Territory',
109 'British Virgin Islands',
110 'Brunei Darussalam',
111 'Bulgaria',
112 'Burkina Faso',
113 'Burundi',
114 'Cambodia',
115 'Cameroon',
116 'Canada',
117 'Cape Verde',
118 'Cayman Islands',
119 'Central African Republic',
120 'Chad',
121 'Chile',
122 'China',
123 'Christmas Island',
124 'Cocos Islands',
125 'Colombia',
126 'Comoros',
127 'Congo',
128 'Cook Islands',
129 'Costa Rica',
130 "Cote d'Ivoire",
131 'Croatia',
132 'Cuba',
133 'Cyprus',
134 'Czech Republic',
135 'Denmark',
136 'Djibouti',
137 'Dominica',
138 'Dominican Republic',
139 'Ecuador',
140 'Egypt',
141 'El Salvador',
142 'Equatorial Guinea',
143 'Eritrea',
144 'Estonia',
145 'Ethiopia',
146 'Faroe Islands',
147 'Falkland Islands',
148 'Fiji',
149 'Finland',
150 'France',
151 'French Guiana',
152 'French Polynesia',
153 'French Southern Territories',
154 'Gabon',
155 'Gambia',
156 'Georgia',
157 'Germany',
158 'Ghana',
159 'Gibraltar',
160 'Greece',
161 'Greenland',
162 'Grenada',
163 'Guadeloupe',
164 'Guam',
165 'Guatemala',
166 'Guernsey',
167 'Guinea',
168 'Guinea-Bissau',
169 'Guyana',
170 'Haiti',
171 'Heard Island and McDonald Islands',
172 'Holy See',
173 'Honduras',
174 'Hong Kong',
175 'Hungary',
176 'Iceland',
177 'India',
178 'Indonesia',
179 'Iran',
180 'Iraq',
181 'Ireland',
182 'Isle of Man',
183 'Israel',
184 'Italy',
185 'Jamaica',
186 'Japan',
187 'Jersey',
188 'Jordan',
189 'Kazakhstan',
190 'Kenya',
191 'Kiribati',
192 'Korea',
193 'Korea',
194 'Kuwait',
195 'Kyrgyz Republic',
196 "Lao People's Democratic Republic",
197 'Latvia',
198 'Lebanon',
199 'Lesotho',
200 'Liberia',
201 'Libyan Arab Jamahiriya',
202 'Liechtenstein',
203 'Lithuania',
204 'Luxembourg',
205 'Macao',
206 'Macedonia',
207 'Madagascar',
208 'Malawi',
209 'Malaysia',
210 'Maldives',
211 'Mali',
212 'Malta',
213 'Marshall Islands',
214 'Martinique',
215 'Mauritania',
216 'Mauritius',
217 'Mayotte',
218 'Mexico',
219 'Micronesia',
220 'Moldova',
221 'Monaco',
222 'Mongolia',
223 'Montenegro',
224 'Montserrat',
225 'Morocco',
226 'Mozambique',
227 'Myanmar',
228 'Namibia',
229 'Nauru',
230 'Nepal',
231 'Netherlands Antilles',
232 'Netherlands',
233 'New Caledonia',
234 'New Zealand',
235 'Nicaragua',
236 'Niger',
237 'Nigeria',
238 'Niue',
239 'Norfolk Island',
240 'Northern Mariana Islands',
241 'Norway',
242 'Oman',
243 'Pakistan',
244 'Palau',
245 'Palestinian Territory',
246 'Panama',
247 'Papua New Guinea',
248 'Paraguay',
249 'Peru',
250 'Philippines',
251 'Pitcairn Islands',
252 'Poland',
253 'Portugal',
254 'Puerto Rico',
255 'Qatar',
256 'Reunion',
257 'Romania',
258 'Russian Federation',
259 'Rwanda',
260 'Saint Barthelemy',
261 'Saint Helena',
262 'Saint Kitts and Nevis',
263 'Saint Lucia',
264 'Saint Martin',
265 'Saint Pierre and Miquelon',
266 'Saint Vincent and the Grenadines',
267 'Samoa',
268 'San Marino',
269 'Sao Tome and Principe',
270 'Saudi Arabia',
271 'Senegal',
272 'Serbia',
273 'Seychelles',
274 'Sierra Leone',
275 'Singapore',
276 'Slovakia (Slovak Republic)',
277 'Slovenia',
278 'Solomon Islands',
279 'Somalia',
280 'South Africa',
281 'South Georgia and the South Sandwich Islands',
282 'Spain',
283 'Sri Lanka',
284 'Sudan',
285 'Suriname',
286 'Svalbard & Jan Mayen Islands',
287 'Swaziland',
288 'Sweden',
289 'Switzerland',
290 'Syrian Arab Republic',
291 'Taiwan',
292 'Tajikistan',
293 'Tanzania',
294 'Thailand',
295 'Timor-Leste',
296 'Togo',
297 'Tokelau',
298 'Tonga',
299 'Trinidad and Tobago',
300 'Tunisia',
301 'Turkey',
302 'Turkmenistan',
303 'Turks and Caicos Islands',
304 'Tuvalu',
305 'Uganda',
306 'Ukraine',
307 'United Arab Emirates',
308 'United Kingdom',
309 'United States of America',
310 'United States Minor Outlying Islands',
311 'United States Virgin Islands',
312 'Uruguay',
313 'Uzbekistan',
314 'Vanuatu',
315 'Venezuela',
316 'Vietnam',
317 'Wallis and Futuna',
318 'Western Sahara',
319 'Yemen',
320 'Zambia',
321 'Zimbabwe',
322 ]
323 }
324  
325 method data_for_postal_code() {
326 [
327 '#####',
328 '#####-####',
329 ]
330 }
331  
332 method data_for_state_abbr() {
333 [
334 'AA',
335 'AE',
336 'AK',
337 'AL',
338 'AP',
339 'AR',
340 'AS',
341 'AZ',
342 'CA',
343 'CO',
344 'CT',
345 'DC',
346 'DE',
347 'FL',
348 'FM',
349 'GA',
350 'GU',
351 'HI',
352 'IA',
353 'ID',
354 'IL',
355 'IN',
356 'KS',
357 'KY',
358 'LA',
359 'MA',
360 'MD',
361 'ME',
362 'MH',
363 'MI',
364 'MN',
365 'MO',
366 'MP',
367 'MS',
368 'MT',
369 'NC',
370 'ND',
371 'NE',
372 'NH',
373 'NJ',
374 'NM',
375 'NV',
376 'NY',
377 'OH',
378 'OK',
379 'OR',
380 'PA',
381 'PR',
382 'PW',
383 'RI',
384 'SC',
385 'SD',
386 'TN',
387 'TX',
388 'UT',
389 'VA',
390 'VI',
391 'VT',
392 'WA',
393 'WI',
394 'WV',
395 'WY',
396 ]
397 }
398  
399 method data_for_state_name() {
400 [
401 'Alabama',
402 'Alaska',
403 'Arizona',
404 'Arkansas',
405 'California',
406 'Colorado',
407 'Connecticut',
408 'Delaware',
409 'Florida',
410 'Georgia',
411 'Hawaii',
412 'Idaho',
413 'Illinois',
414 'Indiana',
415 'Iowa',
416 'Kansas',
417 'Kentucky',
418 'Louisiana',
419 'Maine',
420 'Maryland',
421 'Massachusetts',
422 'Michigan',
423 'Minnesota',
424 'Mississippi',
425 'Missouri',
426 'Montana',
427 'Nebraska',
428 'Nevada',
429 'NewHampshire',
430 'NewJersey',
431 'NewMexico',
432 'NewYork',
433 'NorthCarolina',
434 'NorthDakota',
435 'Ohio',
436 'Oklahoma',
437 'Oregon',
438 'Pennsylvania',
439 'RhodeIsland',
440 'SouthCarolina',
441 'SouthDakota',
442 'Tennessee',
443 'Texas',
444 'Utah',
445 'Vermont',
446 'Virginia',
447 'Washington',
448 'WestVirginia',
449 'Wisconsin',
450 'Wyoming',
451 ]
452 }
453  
454 method data_for_street_suffix() {
455 [
456 'Avenue',
457 'Circle',
458 'Parkway',
459 'Street',
460 ]
461 }
462  
463 method format_for_address_data() {
464 [
465 '{{address.street_address}}\n{{address.city_name}}, {{address.state_abbr}} {{address.postal_code}}'
466 ]
467 }
468  
469 method format_for_city_name() {
470 [
471 '{{address.city_prefix}} {{person.first_name}}{{address.city_suffix}}',
472 '{{address.city_prefix}} {{person.first_name}}',
473 '{{person.first_name}}{{address.city_suffix}}',
474 '{{person.last_name}}{{address.city_suffix}}',
475 ]
476 }
477  
478 method format_for_line1() {
479 [
480 '{{address.number}} {{address.street_name}}',
481 ]
482 }
483  
484 method format_for_line2() {
485 [
486 'Apt. ###',
487 'Suite ###',
488 ]
489 }
490  
491 method format_for_lines() {
492 [
493 '{{address.line1}}, {{address.city_name}}, {{address.postal_code}}',
494 '{{address.line1}}, {{address.city_name}}, {{address.state_abbr}} {{address.postal_code}}',
495 '{{address.line1}}, {{address.line2}}, {{address.city_name}}, {{address.postal_code}}',
496 '{{address.line1}}\n{{address.line2}}\n{{address.city_name}}, {{address.postal_code}}',
497 '{{address.line1}}\n{{address.line2}}\n{{address.city_name}}, {{address.state_abbr}} {{address.postal_code}}',
498 ]
499 }
500  
501 method format_for_street_name() {
502 [
503 '{{person.first_name}} {{address.street_suffix}}',
504 '{{person.last_name}} {{address.street_suffix}}',
505 ]
506 }
507  
508 method format_for_street_address() {
509 [
510 '{{address.number}} {{address.street_name}}',
511 '{{address.number}} {{address.street_name}} {{address.line2}}',
512 ]
513 }
514  
515 1;