Bugzilla – Attachment 129489 Details for
Bug 28238
Add itemcallnumber to ILS-DI GetAvailability output
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28238: Add tests
Bug-28238-Add-tests.patch (text/plain), 3.95 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-01-14 14:28:40 UTC
(
hide
)
Description:
Bug 28238: Add tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-01-14 14:28:40 UTC
Size:
3.95 KB
patch
obsolete
>From e4e87b63a261cfdf517889ef96f98fdd246eae61 Mon Sep 17 00:00:00 2001 >From: Marion Durand <marion.durand@biblibre.com> >Date: Tue, 9 Nov 2021 11:04:34 +0000 >Subject: [PATCH] Bug 28238: Add tests > >Add specific tests for the tag itemcallnumber in GetAvailability output. > >Sponsored-by: University Lyon 3 > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/ILSDI_Services.t | 75 ++++++++++++++++++++++++++++++++- > 1 file changed, 73 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index 0aa7be657a..4e525899eb 100755 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -19,11 +19,12 @@ use Modern::Perl; > > use CGI qw ( -utf8 ); > >-use Test::More tests => 10; >+use Test::More tests => 11; > use Test::MockModule; > use t::lib::Mocks; > use t::lib::TestBuilder; > use t::lib::Dates; >+use XML::LibXML; > > use C4::Items qw( ModItemTransfer ); > use C4::Circulation qw( AddIssue ); >@@ -32,7 +33,7 @@ use Koha::AuthUtils; > use Koha::DateUtils qw( dt_from_string ); > > BEGIN { >- use_ok('C4::ILSDI::Services', qw( AuthenticatePatron GetPatronInfo LookupPatron HoldTitle HoldItem GetRecords RenewLoan )); >+ use_ok('C4::ILSDI::Services', qw( AuthenticatePatron GetPatronInfo LookupPatron HoldTitle HoldItem GetRecords RenewLoan GetAvailability )); > } > > my $schema = Koha::Database->schema; >@@ -788,3 +789,73 @@ subtest 'GetPatronInfo paginated loans' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'GetAvailability itemcallnumber' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ t::lib::Mocks::mock_preference( 'ILS-DI', 1 ); >+ >+ my $item1 = $builder->build_sample_item( >+ { >+ itemcallnumber => "callnumber", >+ } >+ ); >+ >+ my $item2 = $builder->build_sample_item( {} ); >+ >+ # Build the query >+ my $cgi = CGI->new; >+ $cgi->param( service => 'GetAvailability' ); >+ $cgi->param( id => $item1->itemnumber ); >+ $cgi->param( id_type => 'item' ); >+ >+ # Output of GetAvailability is a string containing XML >+ my $reply = C4::ILSDI::Services::GetAvailability($cgi); >+ >+ # Parse the output and get info >+ my $result_XML = XML::LibXML->load_xml( string => $reply ); >+ my $reply_callnumber = >+ $result_XML->findnodes('//dlf:itemcallnumber')->to_literal(); >+ >+ # Test the output >+ is( $reply_callnumber, $item1->itemcallnumber, >+ "GetAvailability item has an itemcallnumber tag" ); >+ >+ $cgi = CGI->new; >+ $cgi->param( service => 'GetAvailability' ); >+ $cgi->param( id => $item2->itemnumber ); >+ $cgi->param( id_type => 'item' ); >+ $reply = C4::ILSDI::Services::GetAvailability($cgi); >+ $result_XML = XML::LibXML->load_xml( string => $reply ); >+ $reply_callnumber = >+ $result_XML->findnodes('//dlf:itemcallnumber')->to_literal(); >+ is( $reply_callnumber, '', >+ "As expected, GetAvailability item has no itemcallnumber tag" ); >+ >+ $cgi = CGI->new; >+ $cgi->param( service => 'GetAvailability' ); >+ $cgi->param( id => $item1->biblionumber ); >+ $cgi->param( id_type => 'biblio' ); >+ $reply = C4::ILSDI::Services::GetAvailability($cgi); >+ $result_XML = XML::LibXML->load_xml( string => $reply ); >+ $reply_callnumber = >+ $result_XML->findnodes('//dlf:itemcallnumber')->to_literal(); >+ is( $reply_callnumber, $item1->itemcallnumber, >+ "GetAvailability biblio has an itemcallnumber tag" ); >+ >+ $cgi = CGI->new; >+ $cgi->param( service => 'GetAvailability' ); >+ $cgi->param( id => $item2->biblionumber ); >+ $cgi->param( id_type => 'biblio' ); >+ $reply = C4::ILSDI::Services::GetAvailability($cgi); >+ $result_XML = XML::LibXML->load_xml( string => $reply ); >+ $reply_callnumber = >+ $result_XML->findnodes('//dlf:itemcallnumber')->to_literal(); >+ is( $reply_callnumber, '', >+ "As expected, GetAvailability biblio has no itemcallnumber tag" ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.32.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 28238
:
120242
|
121399
|
126909
|
126947
|
126948
|
127130
|
127131
|
127132
|
127478
| 129489 |
129490
|
129491