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

(-)a/t/db_dependent/XISBN.t (-7 / +10 lines)
Lines 5-11 Link Here
5
5
6
use Modern::Perl;
6
use Modern::Perl;
7
7
8
use Test::More tests => 5;
8
use Test::More tests => 6;
9
use List::MoreUtils qw(any none);
9
use MARC::Record;
10
use MARC::Record;
10
use C4::Biblio;
11
use C4::Biblio;
11
use C4::XISBN;
12
use C4::XISBN;
Lines 41-50 my $isbn2 = '0684843897'; Link Here
41
# XISBN match : Harry Potter and the Sorcerer's Stone,
42
# XISBN match : Harry Potter and the Sorcerer's Stone,
42
# 1. Scholastic mass market paperback printing1.
43
# 1. Scholastic mass market paperback printing1.
43
my $isbn3 = '043936213X';
44
my $isbn3 = '043936213X';
45
# Finn Family Moomintroll, won't match to other isbns
46
my $isbn4 = '014030150X';
44
47
45
my $biblionumber1 = _add_biblio_with_isbn($isbn1);
48
my $biblionumber1 = _add_biblio_with_isbn($isbn1);
46
my $biblionumber2 = _add_biblio_with_isbn($isbn2);
49
my $biblionumber2 = _add_biblio_with_isbn($isbn2);
47
my $biblionumber3 = _add_biblio_with_isbn($isbn3);
50
my $biblionumber3 = _add_biblio_with_isbn($isbn3);
51
my $biblionumber4 = _add_biblio_with_isbn($isbn4);
48
52
49
my $trial = C4::XISBN::_get_biblio_from_xisbn($isbn1);
53
my $trial = C4::XISBN::_get_biblio_from_xisbn($isbn1);
50
is( $trial->{biblionumber},
54
is( $trial->{biblionumber},
Lines 54-65 is( $trial->{biblionumber}, Link Here
54
t::lib::Mocks::mock_preference( 'ThingISBN', 1 );
58
t::lib::Mocks::mock_preference( 'ThingISBN', 1 );
55
59
56
my $results_thingisbn;
60
my $results_thingisbn;
57
eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1); };
61
eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1, $biblionumber4); };
58
SKIP: {
62
SKIP: {
59
    skip "Problem retrieving ThingISBN", 1
63
    skip "Problem retrieving ThingISBN", 1
60
        unless $@ eq '';
64
        unless $@ eq '';
61
    is( $results_thingisbn->[0]->{biblionumber},
65
    ok( (any { $_->{'biblionumber'} eq $biblionumber1 } @$results_thingisbn),
62
        $biblionumber3,
66
        "Gets correct biblionumber from a book with a similar isbn using ThingISBN." );
67
    ok( (any { $_->{'biblionumber'} eq $biblionumber3 } @$results_thingisbn),
63
        "Gets correct biblionumber from a book with a similar isbn using ThingISBN." );
68
        "Gets correct biblionumber from a book with a similar isbn using ThingISBN." );
64
}
69
}
65
70
Lines 76-83 eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1,$biblionumber3); }; Link Here
76
SKIP: {
81
SKIP: {
77
    skip "Problem retrieving ThingISBN", 1
82
    skip "Problem retrieving ThingISBN", 1
78
        unless $@ eq '';
83
        unless $@ eq '';
79
    is( $results_thingisbn->[0]->{biblionumber},
84
    ok( (none { $_->{'biblionumber'} eq $biblionumber3 } @$results_thingisbn),
80
        undef,
81
        "Doesn't get biblionumber if the biblionumber matches the one passed to the sub." );
85
        "Doesn't get biblionumber if the biblionumber matches the one passed to the sub." );
82
}
86
}
83
87
84
- 

Return to bug 26364