|
Lines 5-11
Link Here
|
| 5 |
|
5 |
|
| 6 |
use strict; |
6 |
use strict; |
| 7 |
use warnings; |
7 |
use warnings; |
| 8 |
use Test::More tests => 17; |
8 |
use Test::More tests => 40; |
| 9 |
use MARC::Record; |
9 |
use MARC::Record; |
| 10 |
use C4::Biblio; |
10 |
use C4::Biblio; |
| 11 |
|
11 |
|
|
Lines 111-113
is( $controlnumber, '123456789X', 'GetMarcControlnumber handles records with 001
Link Here
|
| 111 |
|
111 |
|
| 112 |
# clean up after ourselves |
112 |
# clean up after ourselves |
| 113 |
DelBiblio($biblionumber); |
113 |
DelBiblio($biblionumber); |
| 114 |
- |
114 |
|
|
|
115 |
# Testing GetMarcSubfieldStructureFromKohaField |
| 116 |
my @columns = qw( |
| 117 |
tagfield tagsubfield liblibrarian libopac repeatable mandatory kohafield tab |
| 118 |
authorised_value authtypecode value_builder isurl hidden frameworkcode |
| 119 |
seealso link defaultvalue maxlength |
| 120 |
); |
| 121 |
|
| 122 |
# biblio.biblionumber must be mapped so this should return something |
| 123 |
my $marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('biblio.biblionumber', ''); |
| 124 |
|
| 125 |
ok(defined $marc_subfield_structure, "There is a result"); |
| 126 |
is(ref $marc_subfield_structure, "HASH", "Result is a hashref"); |
| 127 |
foreach my $col (@columns) { |
| 128 |
ok(exists $marc_subfield_structure->{$col}, "Hashref contains key '$col'"); |
| 129 |
} |
| 130 |
is($marc_subfield_structure->{kohafield}, 'biblio.biblionumber', "Result is the good result"); |
| 131 |
like($marc_subfield_structure->{tagfield}, qr/^\d{3}$/, "tagfield is a valid tagfield"); |
| 132 |
|
| 133 |
# foo.bar does not exist so this should return undef |
| 134 |
$marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('foo.bar', ''); |
| 135 |
is($marc_subfield_structure, undef, "invalid kohafield returns undef"); |