Bugzilla – Attachment 91016 Details for
Bug 23165
Renewals for Self Checkout (SCO) module do not record branchcode in statistics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23165: Unit tests
Bug-23165-Unit-tests.patch (text/plain), 6.37 KB, created by
Kyle M Hall (khall)
on 2019-06-26 11:44:44 UTC
(
hide
)
Description:
Bug 23165: Unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-06-26 11:44:44 UTC
Size:
6.37 KB
patch
obsolete
>From 2da1c799760b6d39b7ef95d4b56ecab3f99c88e6 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Wed, 26 Jun 2019 07:43:53 -0400 >Subject: [PATCH] Bug 23165: Unit tests > >--- > t/db_dependent/Circulation/issue.t | 135 ++++++++++++++++++++++++----- > 1 file changed, 114 insertions(+), 21 deletions(-) > >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index e945876378..eb91b5f50c 100644 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -23,10 +23,10 @@ use DateTime::Duration; > use t::lib::Mocks; > use t::lib::TestBuilder; > >-use C4::Circulation; >-use C4::Items; > use C4::Biblio; >+use C4::Circulation; > use C4::Context; >+use C4::Items; > use C4::Reserves; > use Koha::Checkouts; > use Koha::Database; >@@ -243,25 +243,118 @@ like( > my $stat = $dbh->selectrow_hashref("SELECT * FROM statistics WHERE type = 'renew' AND borrowernumber = ? AND itemnumber = ? AND branch = ?", undef, $borrower_id1, $item_id1, $branchcode_3 ); > ok( $stat, "Bug 17781 - 'Improper branchcode set during renewal' still fixed" ); > >-$se->mock( 'interface', sub {return 'opac'}); >- >-#Let's do an opac renewal - whatever branchcode we send should be used >-my $opac_renew_issue = $builder->build({ >- source=>"Issue", >- value=>{ >- date_due => '2017-01-01', >- branch => $branchcode_1, >- itype => $itemtype, >- borrowernumber => $borrower_id1 >- } >-}); >- >-my $datedue4 = AddRenewal( $opac_renew_issue->{borrowernumber}, $opac_renew_issue->{itemnumber}, "Stavromula", $datedue1, $daysago10 ); >- >-$stat = $dbh->selectrow_hashref("SELECT * FROM statistics WHERE type = 'renew' AND borrowernumber = ? AND itemnumber = ? AND branch = ?", undef, $opac_renew_issue->{borrowernumber}, $opac_renew_issue->{itemnumber}, "Stavromula" ); >-ok( $stat, "Bug 18572 - 'Bug 18572 - OpacRenewalBranch is now respected" ); >- >- >+subtest 'Show that AddRenewal respects OpacRenewalBranch and interface' => sub { >+ plan tests => 5; >+ >+ $se->mock( 'interface', sub { return 'opac' } ); >+ >+ t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'OPACRenew' ); >+ my $opac_renew_issue = $builder->build( >+ { >+ source => "Issue", >+ value => { >+ date_due => '2017-01-01', >+ returndate => undef, >+ branch => $branchcode_1, >+ itype => $itemtype, >+ borrowernumber => $borrower_id1 >+ } >+ } >+ ); >+ AddRenewal( >+ $opac_renew_issue->{borrowernumber}, >+ $opac_renew_issue->{itemnumber}, >+ "Stavromula", $datedue1, $daysago10 >+ ); >+ my $stat = $schema->resultset('Statistic')->search({ itemnumber => $opac_renew_issue->{itemnumber}})->next; >+ is( $stat->branch, "OPACRenew", "OpacRenewalBranch is respected for OpacRenewalBranch = OPACRenew" ); >+ >+ t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'checkoutbranch' ); >+ $opac_renew_issue = $builder->build( >+ { >+ source => "Issue", >+ value => { >+ date_due => '2017-01-01', >+ returndate => undef, >+ branch => $branchcode_1, >+ itype => $itemtype, >+ borrowernumber => $borrower_id1 >+ } >+ } >+ ); >+ AddRenewal( >+ $opac_renew_issue->{borrowernumber}, >+ $opac_renew_issue->{itemnumber}, >+ "Stavromula", $datedue1, $daysago10 >+ ); >+ $stat = $schema->resultset('Statistic')->search({ itemnumber => $opac_renew_issue->{itemnumber}})->next; >+ is( $stat->branch, $opac_renew_issue->{branchcode}, "OpacRenewalBranch is respected for OpacRenewalBranch = checkoutbranch" ); >+ >+ t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'patronhomebranch' ); >+ $opac_renew_issue = $builder->build( >+ { >+ source => "Issue", >+ value => { >+ date_due => '2017-01-01', >+ returndate => undef, >+ branch => $branchcode_1, >+ itype => $itemtype, >+ borrowernumber => $borrower_id1 >+ } >+ } >+ ); >+ AddRenewal( >+ $opac_renew_issue->{borrowernumber}, >+ $opac_renew_issue->{itemnumber}, >+ "Stavromula", $datedue1, $daysago10 >+ ); >+ $stat = $schema->resultset('Statistic')->search({ itemnumber => $opac_renew_issue->{itemnumber}})->next; >+ my $patron = Koha::Patrons->find( $borrower_id1 ); >+ is( $stat->branch, $patron->branchcode, "OpacRenewalBranch is respected for OpacRenewalBranch = patronhomebranch" ); >+ >+ t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'itemhomebranch' ); >+ $opac_renew_issue = $builder->build( >+ { >+ source => "Issue", >+ value => { >+ date_due => '2017-01-01', >+ returndate => undef, >+ branch => $branchcode_1, >+ itype => $itemtype, >+ borrowernumber => $borrower_id1 >+ } >+ } >+ ); >+ AddRenewal( >+ $opac_renew_issue->{borrowernumber}, >+ $opac_renew_issue->{itemnumber}, >+ "Stavromula", $datedue1, $daysago10 >+ ); >+ $stat = $schema->resultset('Statistic')->search({ itemnumber => $opac_renew_issue->{itemnumber}})->next; >+ my $item = Koha::Items->find( $opac_renew_issue->{itemnumber} ); >+ is( $stat->branch, $item->homebranch, "OpacRenewalBranch is respected for OpacRenewalBranch = itemhomebranch" ); >+ >+ t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'NULL' ); >+ $opac_renew_issue = $builder->build( >+ { >+ source => "Issue", >+ value => { >+ date_due => '2017-01-01', >+ returndate => undef, >+ branch => $branchcode_1, >+ itype => $itemtype, >+ borrowernumber => $borrower_id1 >+ } >+ } >+ ); >+ AddRenewal( >+ $opac_renew_issue->{borrowernumber}, >+ $opac_renew_issue->{itemnumber}, >+ "Stavromula", $datedue1, $daysago10 >+ ); >+ $stat = $schema->resultset('Statistic')->search({ itemnumber => $opac_renew_issue->{itemnumber}})->next; >+ is( $stat->branch, "", "OpacRenewalBranch is respected for OpacRenewalBranch = NULL" ); >+}; > > #Test GetBiblioIssues > is( GetBiblioIssues(), undef, "GetBiblio Issues without parameters" ); >-- >2.20.1 (Apple Git-117)
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 23165
:
90815
|
90997
|
91016
|
91227
|
94364
|
94365