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

(-)a/t/AuthoritiesMarc.t (+48 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
use Modern::Perl;
4
use Test::More tests => 8;
5
6
use t::lib::Mocks;
7
use C4::Context;
8
use MARC::Field;
9
10
BEGIN{
11
    use_ok('C4::AuthoritiesMarc');
12
}
13
14
t::lib::Mocks::mock_preference('marcflavour', 'UNIMARC');
15
16
is( C4::AuthoritiesMarc::authorityflavour(), q{UNIMARCAUTH}, 'marcflavour returns "UNIMARCAUTH" if UNIMARC' );
17
18
19
my @fields = (
20
    MARC::Field->new(
21
        200, '', '',
22
        a => 'text0',
23
        d => '2010',
24
    ),
25
    MARC::Field->new(
26
        201, '', '',
27
        a => 'text1',
28
        c => '2001',
29
    ),
30
    MARC::Field->new(
31
        202, '', '',
32
        a => 'text2',
33
        9 => '2002',
34
    ),
35
    MARC::Field->new(
36
        203, '', '',
37
        b => 'text3',
38
        h => '2003',
39
    ),
40
);
41
42
is( C4::AuthoritiesMarc::_test_string( 'text0', @fields ), 1, "text0 exists" );
43
is( C4::AuthoritiesMarc::_test_string( '2001', @fields ), 1, "2001 exists" );
44
is( C4::AuthoritiesMarc::_test_string( 'text2', @fields ), 1, "text2 exists" );
45
is( C4::AuthoritiesMarc::_test_string( '2003', @fields ), 1, "2003 exists" );
46
is( C4::AuthoritiesMarc::_test_string( 'text4', @fields ), 0, "text4 does not exist" );
47
is( C4::AuthoritiesMarc::_test_string( '2004', @fields ), 0, "2004 does not exist" );
48
(-)a/t/Charset.t (-4 / +35 lines)
Lines 1-9 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
use strict;
3
use Modern::Perl;
4
use warnings;
4
use MARC::Record;
5
use MARC::Field;
6
7
use Test::More tests => 10;
5
8
6
use Test::More tests => 6;
7
BEGIN {
9
BEGIN {
8
    use_ok('C4::Charset');
10
    use_ok('C4::Charset');
9
}
11
}
Lines 18-20 ok(!utf8::is_utf8($octets), "verify that IsStringUTF8ish does not magically turn Link Here
18
20
19
$octets = "a\xc2" . "c";
21
$octets = "a\xc2" . "c";
20
ok(!IsStringUTF8ish($octets), "verify octets are not valid UTF-8");
22
ok(!IsStringUTF8ish($octets), "verify octets are not valid UTF-8");
21
- 
23
24
my $record = MARC::Record->new;
25
my @fields = (
26
    MARC::Field->new(
27
        200, '', '',
28
        a => q{l&ampoule},
29
    ),
30
    MARC::Field->new(
31
        201, '', '',
32
        a => q{l&&école},
33
    ),
34
    MARC::Field->new(
35
        202, '', '',
36
        a => q{l&&&&astronaute},
37
    ),
38
    MARC::Field->new(
39
        203, '', '',
40
        a => q{l'ampoule},
41
    ),
42
);
43
$record->append_fields(@fields);
44
45
C4::Charset::SanitizeEntity( $record );
46
47
is( $record->subfield('200', 'a'), q{l&ampoule});
48
is( $record->subfield('201', 'a'), q{l&école});
49
is( $record->subfield('202', 'a'), q{l&astronaute});
50
is( $record->subfield('203', 'a'), q{l'ampoule});
51
52

Return to bug 8304