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

(-)a/t/db_dependent/Koha/Biblio.t (-4 / +27 lines)
Lines 999-1005 subtest 'get_volumes_query' => sub { Link Here
999
};
999
};
1000
1000
1001
subtest 'generate_marc_host_field' => sub {
1001
subtest 'generate_marc_host_field' => sub {
1002
    plan tests => 22;
1002
    plan tests => 24;
1003
1003
1004
    $schema->storage->txn_begin;
1004
    $schema->storage->txn_begin;
1005
1005
Lines 1011-1017 subtest 'generate_marc_host_field' => sub { Link Here
1011
        MARC::Field->new( '001', '1234' ),
1011
        MARC::Field->new( '001', '1234' ),
1012
        MARC::Field->new( '003', 'FIRST' ),
1012
        MARC::Field->new( '003', 'FIRST' ),
1013
        MARC::Field->new( '240', '', '', a => 'A uniform title' ),
1013
        MARC::Field->new( '240', '', '', a => 'A uniform title' ),
1014
        MARC::Field->new( '260', '', '', a => 'Publication' ),
1014
        MARC::Field->new( '260', '', '', a => 'Publication 260' ),
1015
        MARC::Field->new( '250', '', '', a => 'Edition a', b => 'Edition b' ),
1015
        MARC::Field->new( '250', '', '', a => 'Edition a', b => 'Edition b' ),
1016
        MARC::Field->new( '022', '', '', a => '0317-8471' ),
1016
        MARC::Field->new( '022', '', '', a => '0317-8471' ),
1017
    );
1017
    );
Lines 1025-1031 subtest 'generate_marc_host_field' => sub { Link Here
1025
    is( $link->tag,           '773',                 "MARC::Field->tag returns '773' when marcflavour is 'MARC21" );
1025
    is( $link->tag,           '773',                 "MARC::Field->tag returns '773' when marcflavour is 'MARC21" );
1026
    is( $link->subfield('a'), 'Some boring author',  'MARC::Field->subfield(a) returns content from 100ab' );
1026
    is( $link->subfield('a'), 'Some boring author',  'MARC::Field->subfield(a) returns content from 100ab' );
1027
    is( $link->subfield('b'), 'Edition a Edition b', 'MARC::Field->subfield(b) returns content from 250ab' );
1027
    is( $link->subfield('b'), 'Edition a Edition b', 'MARC::Field->subfield(b) returns content from 250ab' );
1028
    is( $link->subfield('d'), 'Publication',         'MARC::Field->subfield(c) returns content from 260abc' );
1028
    is( $link->subfield('d'), 'Publication 260',     'MARC::Field->subfield(c) returns content from 260abc' );
1029
    is( $link->subfield('s'), 'A uniform title',     'MARC::Field->subfield(s) returns content from 240a' );
1029
    is( $link->subfield('s'), 'A uniform title',     'MARC::Field->subfield(s) returns content from 240a' );
1030
    is( $link->subfield('t'), 'Some boring read',    'MARC::Field->subfield(s) returns content from 245ab' );
1030
    is( $link->subfield('t'), 'Some boring read',    'MARC::Field->subfield(s) returns content from 245ab' );
1031
    is( $link->subfield('x'), '0317-8471',           'MARC::Field->subfield(s) returns content from 022a' );
1031
    is( $link->subfield('x'), '0317-8471',           'MARC::Field->subfield(s) returns content from 022a' );
Lines 1039-1044 subtest 'generate_marc_host_field' => sub { Link Here
1039
        'MARC::Field->subfield(w) returns content from 003 and 001 when "UseControlNumber" is enabled'
1039
        'MARC::Field->subfield(w) returns content from 003 and 001 when "UseControlNumber" is enabled'
1040
    );
1040
    );
1041
1041
1042
    $record->append_fields(
1043
        MARC::Field->new( '264', '', '', a => 'Publication 264' ),
1044
    );
1045
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
1046
    $biblio = Koha::Biblios->find( $biblio->biblionumber );
1047
1048
    $link = $biblio->generate_marc_host_field();
1049
    is(
1050
        $link->subfield('d'), 'Publication 264',
1051
        'MARC::Field->subfield(d) returns content from 264 in preference to 260'
1052
    );
1053
1054
    $record->append_fields(
1055
        MARC::Field->new( '264', '3', '', a => 'Publication 264', b => 'Preferred' ),
1056
    );
1057
    C4::Biblio::ModBiblio( $record, $biblio->biblionumber );
1058
    $biblio = Koha::Biblios->find( $biblio->biblionumber );
1059
1060
    $link = $biblio->generate_marc_host_field();
1061
    is(
1062
        $link->subfield('d'), 'Publication 264 Preferred',
1063
        'MARC::Field->subfield(d) returns content from 264 with indicator 1 = 3 in preference to 264 without'
1064
    );
1065
1042
    # UNIMARC tests
1066
    # UNIMARC tests
1043
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
1067
    t::lib::Mocks::mock_preference( 'marcflavour', 'UNIMARC' );
1044
1068
1045
- 

Return to bug 37364