Bugzilla – Attachment 109825 Details for
Bug 26364
XISBN.t makes a bad assumption about return values
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26364: Adjust unit tests
Bug-26364-Adjust-unit-tests.patch (text/plain), 2.64 KB, created by
Nick Clemens (kidclamp)
on 2020-09-09 14:37:06 UTC
(
hide
)
Description:
Bug 26364: Adjust unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-09-09 14:37:06 UTC
Size:
2.64 KB
patch
obsolete
>From c85ab635a815f13a5a8e466fb3ad3d268c3b06b6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 9 Sep 2020 14:34:26 +0000 >Subject: [PATCH] Bug 26364: Adjust unit tests > >We shouldn't rely on knowing exactly which ISBNs we get, we should specifically >check for what we do or don't expect. > >I believe we should return biblios that have the same isbn we passed, as it signlas we have another >biblio in the catalog that matches the one we are on. > >To test: >prove -v t/db_dependent/XISBN.t >--- > t/db_dependent/XISBN.t | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t >index c8dd830292..8a1dae5fda 100755 >--- a/t/db_dependent/XISBN.t >+++ b/t/db_dependent/XISBN.t >@@ -5,7 +5,8 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; >+use List::MoreUtils qw(any none); > use MARC::Record; > use C4::Biblio; > use C4::XISBN; >@@ -41,10 +42,13 @@ my $isbn2 = '0684843897'; > # XISBN match : Harry Potter and the Sorcerer's Stone, > # 1. Scholastic mass market paperback printing1. > my $isbn3 = '043936213X'; >+# Finn Family Moomintroll, won't match to other isbns >+my $isbn4 = '014030150X'; > > my $biblionumber1 = _add_biblio_with_isbn($isbn1); > my $biblionumber2 = _add_biblio_with_isbn($isbn2); > my $biblionumber3 = _add_biblio_with_isbn($isbn3); >+my $biblionumber4 = _add_biblio_with_isbn($isbn4); > > my $trial = C4::XISBN::_get_biblio_from_xisbn($isbn1); > is( $trial->{biblionumber}, >@@ -54,12 +58,13 @@ is( $trial->{biblionumber}, > t::lib::Mocks::mock_preference( 'ThingISBN', 1 ); > > my $results_thingisbn; >-eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1); }; >+eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1, $biblionumber4); }; > SKIP: { > skip "Problem retrieving ThingISBN", 1 > unless $@ eq ''; >- is( $results_thingisbn->[0]->{biblionumber}, >- $biblionumber3, >+ ok( (any { $_->{'biblionumber'} eq $biblionumber1 } @$results_thingisbn), >+ "Gets correct biblionumber from a book with a similar isbn using ThingISBN." ); >+ ok( (any { $_->{'biblionumber'} eq $biblionumber3 } @$results_thingisbn), > "Gets correct biblionumber from a book with a similar isbn using ThingISBN." ); > } > >@@ -76,8 +81,7 @@ eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1,$biblionumber3); }; > SKIP: { > skip "Problem retrieving ThingISBN", 1 > unless $@ eq ''; >- is( $results_thingisbn->[0]->{biblionumber}, >- undef, >+ ok( (none { $_->{'biblionumber'} eq $biblionumber3 } @$results_thingisbn), > "Doesn't get biblionumber if the biblionumber matches the one passed to the sub." ); > } > >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26364
:
109599
|
109631
|
109821
|
109822
|
109823
|
109824
|
109825
|
113054
|
113055
|
113056
|
113057
|
113058
|
114818
|
114819
|
114820
|
114821
|
114822