|
Lines 102-108
subtest 'AddBiblio' => sub {
Link Here
|
| 102 |
}; |
102 |
}; |
| 103 |
|
103 |
|
| 104 |
subtest 'GetMarcSubfieldStructureFromKohaField' => sub { |
104 |
subtest 'GetMarcSubfieldStructureFromKohaField' => sub { |
| 105 |
plan tests => 25; |
105 |
plan tests => 26; |
| 106 |
|
106 |
|
| 107 |
my @columns = qw( |
107 |
my @columns = qw( |
| 108 |
tagfield tagsubfield liblibrarian libopac repeatable mandatory kohafield tab |
108 |
tagfield tagsubfield liblibrarian libopac repeatable mandatory kohafield tab |
|
Lines 121-131
subtest 'GetMarcSubfieldStructureFromKohaField' => sub {
Link Here
|
| 121 |
is($marc_subfield_structure->{kohafield}, 'biblio.biblionumber', "Result is the good result"); |
121 |
is($marc_subfield_structure->{kohafield}, 'biblio.biblionumber', "Result is the good result"); |
| 122 |
like($marc_subfield_structure->{tagfield}, qr/^\d{3}$/, "tagfield is a valid tagfield"); |
122 |
like($marc_subfield_structure->{tagfield}, qr/^\d{3}$/, "tagfield is a valid tagfield"); |
| 123 |
|
123 |
|
| 124 |
# Add a test for list context (BZ 10306) |
124 |
# Add a test for list parameter |
| 125 |
my @results = GetMarcSubfieldStructureFromKohaField('biblio.biblionumber'); |
125 |
my $results = GetMarcSubfieldStructureFromKohaField( 'biblio.biblionumber', { list => 1 } ); |
| 126 |
is( @results, 1, 'We expect only one mapping' ); |
126 |
is( ref $results, "ARRAY", "Result is an arrayref when using list => 1" ); |
| 127 |
is_deeply( $results[0], $marc_subfield_structure, |
127 |
is( @$results, 1, 'We expect only one mapping' ); |
| 128 |
'The first entry should be the same hashref as we had before' ); |
128 |
is_deeply( |
|
|
129 |
$results->[0], $marc_subfield_structure, |
| 130 |
'The first entry should be the same hashref as we had before' |
| 131 |
); |
| 129 |
|
132 |
|
| 130 |
# foo.bar does not exist so this should return undef |
133 |
# foo.bar does not exist so this should return undef |
| 131 |
$marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('foo.bar'); |
134 |
$marc_subfield_structure = GetMarcSubfieldStructureFromKohaField('foo.bar'); |
| 132 |
- |
|
|