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

(-)a/t/db_dependent/Biblio/TransformMarcToKoha.t (-4 / +5 lines)
Lines 42-61 Koha::MarcSubfieldStructure->new({ frameworkcode => '', tagfield => '500', tagsu Link Here
42
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
42
Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
43
43
44
subtest 'Test a few mappings' => sub {
44
subtest 'Test a few mappings' => sub {
45
    plan tests => 7;
45
    plan tests => 8;
46
46
47
    my $marc = MARC::Record->new;
47
    my $marc = MARC::Record->new;
48
    $marc->append_fields(
48
    $marc->append_fields(
49
        MARC::Field->new( '020', '', '', a => '978-0441-172719' ),
49
        MARC::Field->new( '300', '', '', a => 'a1', b => 'b1' ),
50
        MARC::Field->new( '300', '', '', a => 'a1', b => 'b1' ),
50
        MARC::Field->new( '300', '', '', a => 'a2', b => 'b2' ),
51
        MARC::Field->new( '300', '', '', a => 'a2', b => 'b2' ),
51
        MARC::Field->new( '500', '', '', a => 'note1', a => 'note2' ),
52
        MARC::Field->new( '500', '', '', a => 'note1', a => 'note2' ),
52
    );
53
    );
53
    my $result = C4::Biblio::TransformMarcToKoha( $marc );
54
    my $result = C4::Biblio::TransformMarcToKoha( $marc );
54
        # Note: TransformMarcToKoha stripped the table prefix biblio.
55
        # Note: TransformMarcToKoha stripped the table prefix biblio.
55
    is( keys %{$result}, 3, 'Found all three mappings' );
56
    is( keys %{$result}, 4, 'Found all mappings' );
56
    is( $result->{field1}, 'a1 | a2', 'Check field1 results' );
57
    is( $result->{field1}, 'a1 | a2', 'Check field1 results' );
57
    is( $result->{field2}, 'b1 | b2', 'Check field2 results' );
58
    is( $result->{field2}, 'b1 | b2', 'Check field2 results' );
58
    is( $result->{field3}, 'note1 | note2', 'Check field3 results' );
59
    is( $result->{field3}, 'note1 | note2', 'Check field3 results' );
60
    is( $result->{isbn}, '9780441172719', 'ISBN hypens have been removed' );
59
61
60
    is( C4::Biblio::TransformMarcToKohaOneField( 'biblio.field1', $marc ),
62
    is( C4::Biblio::TransformMarcToKohaOneField( 'biblio.field1', $marc ),
61
        $result->{field1}, 'TransformMarcToKohaOneField returns biblio.field1');
63
        $result->{field1}, 'TransformMarcToKohaOneField returns biblio.field1');
Lines 67-73 subtest 'Test a few mappings' => sub { Link Here
67
    # CAUTION: This parameter of TransformMarcToKoha will be removed later
69
    # CAUTION: This parameter of TransformMarcToKoha will be removed later
68
    my $new_fw = t::lib::TestBuilder->new->build({source => 'BiblioFramework'});
70
    my $new_fw = t::lib::TestBuilder->new->build({source => 'BiblioFramework'});
69
    $result = C4::Biblio::TransformMarcToKoha($marc, $new_fw->{frameworkcode});
71
    $result = C4::Biblio::TransformMarcToKoha($marc, $new_fw->{frameworkcode});
70
    is( keys %{$result}, 3, 'Still found all three mappings' );
72
    is( keys %{$result}, 4, 'Still found all mappings' );
71
};
73
};
72
74
73
subtest 'Multiple mappings for one kohafield' => sub {
75
subtest 'Multiple mappings for one kohafield' => sub {
74
- 

Return to bug 27774