Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 3; |
20 |
use Test::More tests => 4; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
|
22 |
|
23 |
use MARC::Record; |
23 |
use MARC::Record; |
Lines 252-256
subtest 'UNIMARC' => sub {
Link Here
|
252 |
$dbh->rollback; |
252 |
$dbh->rollback; |
253 |
}; |
253 |
}; |
254 |
|
254 |
|
|
|
255 |
subtest 'GetMarcSubfieldStructureFromKohaField' => sub { |
256 |
plan tests => 23; |
257 |
|
258 |
my @columns = qw( |
259 |
tagfield tagsubfield liblibrarian libopac repeatable mandatory kohafield tab |
260 |
authorised_value authtypecode value_builder isurl hidden frameworkcode |
261 |
seealso link defaultvalue maxlength |
262 |
); |
263 |
|
264 |
# biblio.biblionumber must be mapped so this should return something |
265 |
my $marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('biblio.biblionumber', ''); |
266 |
|
267 |
ok(defined $marc_subfield_structure, "There is a result"); |
268 |
is(ref $marc_subfield_structure, "HASH", "Result is a hashref"); |
269 |
foreach my $col (@columns) { |
270 |
ok(exists $marc_subfield_structure->{$col}, "Hashref contains key '$col'"); |
271 |
} |
272 |
is($marc_subfield_structure->{kohafield}, 'biblio.biblionumber', "Result is the good result"); |
273 |
like($marc_subfield_structure->{tagfield}, qr/^\d{3}$/, "tagfield is a valid tagfield"); |
274 |
|
275 |
# foo.bar does not exist so this should return undef |
276 |
$marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('foo.bar', ''); |
277 |
is($marc_subfield_structure, undef, "invalid kohafield returns undef"); |
278 |
}; |
255 |
|
279 |
|
256 |
1; |
280 |
1; |
257 |
- |
|
|