|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 4; |
20 |
use Test::More tests => 5; |
| 21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
| 22 |
|
22 |
|
| 23 |
use MARC::Record; |
23 |
use MARC::Record; |
|
Lines 277-281
subtest 'NORMARC' => sub {
Link Here
|
| 277 |
$dbh->rollback; |
277 |
$dbh->rollback; |
| 278 |
}; |
278 |
}; |
| 279 |
|
279 |
|
|
|
280 |
subtest 'GetMarcSubfieldStructureFromKohaField' => sub { |
| 281 |
plan tests => 23; |
| 282 |
|
| 283 |
my @columns = qw( |
| 284 |
tagfield tagsubfield liblibrarian libopac repeatable mandatory kohafield tab |
| 285 |
authorised_value authtypecode value_builder isurl hidden frameworkcode |
| 286 |
seealso link defaultvalue maxlength |
| 287 |
); |
| 288 |
|
| 289 |
# biblio.biblionumber must be mapped so this should return something |
| 290 |
my $marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('biblio.biblionumber', ''); |
| 291 |
|
| 292 |
ok(defined $marc_subfield_structure, "There is a result"); |
| 293 |
is(ref $marc_subfield_structure, "HASH", "Result is a hashref"); |
| 294 |
foreach my $col (@columns) { |
| 295 |
ok(exists $marc_subfield_structure->{$col}, "Hashref contains key '$col'"); |
| 296 |
} |
| 297 |
is($marc_subfield_structure->{kohafield}, 'biblio.biblionumber', "Result is the good result"); |
| 298 |
like($marc_subfield_structure->{tagfield}, qr/^\d{3}$/, "tagfield is a valid tagfield"); |
| 299 |
|
| 300 |
# foo.bar does not exist so this should return undef |
| 301 |
$marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('foo.bar', ''); |
| 302 |
is($marc_subfield_structure, undef, "invalid kohafield returns undef"); |
| 303 |
}; |
| 280 |
|
304 |
|
| 281 |
1; |
305 |
1; |
| 282 |
- |
|
|