Bugzilla – Attachment 117610 Details for
Bug 26618
C4/RotatingCollections.pm should not use C4::Circulation::transferbook
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26618: (QA follow-up) Fix unit test for TranferCollection change
Bug-26618-QA-follow-up-Fix-unit-test-for-TranferCo.patch (text/plain), 3.25 KB, created by
Jonathan Druart
on 2021-03-03 14:33:26 UTC
(
hide
)
Description:
Bug 26618: (QA follow-up) Fix unit test for TranferCollection change
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-03-03 14:33:26 UTC
Size:
3.25 KB
patch
obsolete
>From 856729aba90cddccd1fa1a1ab4643e4e12eb1ea5 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 22 Feb 2021 12:15:44 +0000 >Subject: [PATCH] Bug 26618: (QA follow-up) Fix unit test for TranferCollection > change > >We update TransferCollection to use the settled upon standard for >passing error messages back from a method. This patch updates the >corresponding unit test. >--- > C4/RotatingCollections.pm | 6 +++--- > rotating_collections/transferCollection.pl | 2 +- > t/db_dependent/RotatingCollections.t | 14 +++++++------- > 3 files changed, 11 insertions(+), 11 deletions(-) > >diff --git a/C4/RotatingCollections.pm b/C4/RotatingCollections.pm >index e8e814f455..b7a7bb3a74 100644 >--- a/C4/RotatingCollections.pm >+++ b/C4/RotatingCollections.pm >@@ -399,7 +399,7 @@ sub RemoveItemFromCollection { > > =head2 TransferCollection > >- ( $success, $errorcode, $errormessage ) = TransferCollection( $colId, $colBranchcode ); >+ ( $success, $messages ) = TransferCollection( $colId, $colBranchcode ); > > Transfers a collection to another branch > >@@ -418,10 +418,10 @@ sub TransferCollection { > > ## Check for all necessary parameters > if ( !$colId ) { >- return ( 0, 1, "NO_ID" ); >+ return ( 0, [{ type => 'error', code => 'NO_ID' }] ); > } > if ( !$colBranchcode ) { >- return ( 0, 2, "NO_BRANCHCODE" ); >+ return ( 0, [{ type => 'error', code => 'NO_BRANCHCODE' }] ); > } > > my $dbh = C4::Context->dbh; >diff --git a/rotating_collections/transferCollection.pl b/rotating_collections/transferCollection.pl >index 6c1bcde1ff..f489135407 100755 >--- a/rotating_collections/transferCollection.pl >+++ b/rotating_collections/transferCollection.pl >@@ -43,7 +43,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > ## Transfer collection > my ( $success, $messages ); > if ($toBranch) { >- ( $success, $messages) = >+ ( $success, $messages ) = > TransferCollection( $colId, $toBranch ); > > if ($success) { >diff --git a/t/db_dependent/RotatingCollections.t b/t/db_dependent/RotatingCollections.t >index 4bc5ffa932..7ea21c4c7b 100755 >--- a/t/db_dependent/RotatingCollections.t >+++ b/t/db_dependent/RotatingCollections.t >@@ -194,7 +194,8 @@ my $samplebranch = { > opac_info => 'sample opac', > }; > Koha::Library->new($samplebranch)->store; >-is( TransferCollection( $collection_id1, $samplebranch->{branchcode} ), >+my ( $transferred, $messages ) = TransferCollection( $collection_id1, $samplebranch->{branchcode} ); >+is( $transferred, > 1, "Collection1 has been transfered in the branch SAB" ); > @collection1 = GetCollection($collection_id1); > is_deeply( >@@ -205,12 +206,11 @@ is_deeply( > ], > "Collection1 belongs to the sample branch (SAB)" > ); >-is( TransferCollection, "NO_ID", "TransferCollection without ID" ); >-is( >- TransferCollection($collection_id1), >- 'NO_BRANCHCODE', >- "TransferCollection without branchcode" >-); >+( $transferred, $messages ) = TransferCollection(); >+is( $messages->[0]->{code}, "NO_ID", "TransferCollection without ID" ); >+( $transferred, $messages ) = TransferCollection($collection_id1); >+is( $messages->[0]->{code}, >+ 'NO_BRANCHCODE', "TransferCollection without branchcode" ); > > #Test AddItemToCollection > my $record = MARC::Record->new(); >-- >2.20.1
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 26618
:
111305
|
111313
|
116571
|
117608
|
117609
| 117610 |
117611