View | Details | Raw Unified | Return to bug 19441
Collapse All | Expand All

(-)a/t/db_dependent/Biblio/TransformKohaToMarc.t (-11 / +8 lines)
Lines 4-24 use MARC::Record; Link Here
4
4
5
use t::lib::Mocks;
5
use t::lib::Mocks;
6
use Koha::Database;
6
use Koha::Database;
7
use Koha::Caches;
7
use Koha::Cache;
8
use Koha::MarcSubfieldStructures;
9
use C4::Biblio;
8
use C4::Biblio;
10
9
11
my $schema  = Koha::Database->new->schema;
10
my $schema  = Koha::Database->new->schema;
12
$schema->storage->txn_begin;
11
$schema->storage->txn_begin;
12
my $dbh = C4::Context->dbh;
13
13
14
# Create/overwrite some Koha to MARC mappings in default framework
14
# Create/overwrite some Koha to MARC mappings in default framework
15
my $mapping1 = Koha::MarcSubfieldStructures->find('','300','a') // Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '300', tagsubfield => 'a' });
15
$dbh->do(q|DELETE FROM marc_subfield_structure WHERE frameworkcode='' and tagfield=300 and tagsubfield='a'|);
16
$mapping1->kohafield( "mytable.nicepages" );
16
$dbh->do(q|INSERT INTO marc_subfield_structure(frameworkcode, tagfield, tagsubfield, kohafield) VALUES ('', 300, 'a', 'mytable.nicepages')|);
17
$mapping1->store;
17
$dbh->do(q|DELETE FROM marc_subfield_structure WHERE frameworkcode='' and tagfield=300 and tagsubfield='b'|);
18
my $mapping2 = Koha::MarcSubfieldStructures->find('','300','b') // Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '300', tagsubfield => 'b' });
18
$dbh->do(q|INSERT INTO marc_subfield_structure(frameworkcode, tagfield, tagsubfield, kohafield) VALUES ('', 300, 'b', 'mytable2.goodillustrations')|);
19
$mapping2->kohafield( "mytable2.goodillustrations" );
19
Koha::Cache->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
20
$mapping2->store;
21
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
22
20
23
my $record = C4::Biblio::TransformKohaToMarc({
21
my $record = C4::Biblio::TransformKohaToMarc({
24
    "mytable2.goodillustrations"   => "Other physical details", # 300$b
22
    "mytable2.goodillustrations"   => "Other physical details", # 300$b
Lines 38-42 is_deeply( \@subfields, [ Link Here
38
'TransformKohaToMarc should return sorted subfields (regression test for bug 12343)' );
36
'TransformKohaToMarc should return sorted subfields (regression test for bug 12343)' );
39
37
40
# Cleanup
38
# Cleanup
41
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
39
Koha::Cache->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
42
$schema->storage->txn_rollback;
40
$schema->storage->txn_rollback;
43
- 

Return to bug 19441