Lines 79-85
subtest "Working with control fields" => sub {
Link Here
|
79 |
}; |
79 |
}; |
80 |
|
80 |
|
81 |
subtest "Add tests for _check_split" => sub { |
81 |
subtest "Add tests for _check_split" => sub { |
82 |
plan tests => 7; |
82 |
plan tests => 8; |
83 |
|
83 |
|
84 |
Koha::MarcSubfieldStructures->search({ frameworkcode => '', tagfield => '952', tagsubfield => 'a' })->delete; |
84 |
Koha::MarcSubfieldStructures->search({ frameworkcode => '', tagfield => '952', tagsubfield => 'a' })->delete; |
85 |
Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '952', tagsubfield => 'a', kohafield => 'items.fld1' })->store; |
85 |
Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '952', tagsubfield => 'a', kohafield => 'items.fld1' })->store; |
Lines 88-94
subtest "Add tests for _check_split" => sub {
Link Here
|
88 |
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); |
88 |
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); |
89 |
# add 952a repeatable in another framework |
89 |
# add 952a repeatable in another framework |
90 |
my $fw = $builder->build({ source => 'BiblioFramework' })->{frameworkcode}; |
90 |
my $fw = $builder->build({ source => 'BiblioFramework' })->{frameworkcode}; |
91 |
Koha::MarcSubfieldStructure->new({ frameworkcode => $fw, tagfield => '952', tagsubfield => 'a', repeatable => 1 })->store; |
91 |
Koha::MarcSubfieldStructure->new({ frameworkcode => $fw, tagfield => '952', tagsubfield => 'a', repeatable => 1, kohafield => 'items.fld1' })->store; |
92 |
|
92 |
|
93 |
# Test single value in fld1 |
93 |
# Test single value in fld1 |
94 |
my @cols = ( 'items.fld1' => '01' ); |
94 |
my @cols = ( 'items.fld1' => '01' ); |
Lines 105-113
subtest "Add tests for _check_split" => sub {
Link Here
|
105 |
$record = C4::Biblio::TransformKohaToMarc( { @cols } ); |
105 |
$record = C4::Biblio::TransformKohaToMarc( { @cols } ); |
106 |
is( $record->subfield( '952', 'a' ), '01 | 02', 'Check composite in 952a' ); |
106 |
is( $record->subfield( '952', 'a' ), '01 | 02', 'Check composite in 952a' ); |
107 |
# Test with other framework (repeatable) |
107 |
# Test with other framework (repeatable) |
|
|
108 |
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-". $fw ); |
108 |
$record = C4::Biblio::TransformKohaToMarc( { @cols }, { framework => $fw } ); |
109 |
$record = C4::Biblio::TransformKohaToMarc( { @cols }, { framework => $fw } ); |
109 |
is( ($record->subfield( '952', 'a' ))[0], '01', "Framework $fw first 952a" ); |
110 |
is( ($record->subfield( '952', 'a' ))[0], '01', "Framework $fw first 952a" ); |
110 |
is( ($record->subfield( '952', 'a' ))[1], '02', "Framework $fw second 952a" ); |
111 |
is( ($record->subfield( '952', 'a' ))[1], '02', "Framework $fw second 952a" ); |
|
|
112 |
is( ref(Koha::Caches->get_instance->get_from_cache( "MarcSubfieldStructure-". $fw )), 'HASH', 'We did hit the cache' ); |
111 |
}; |
113 |
}; |
112 |
|
114 |
|
113 |
# Cleanup |
115 |
# Cleanup |
114 |
- |
|
|