Bugzilla – Attachment 100000 Details for
Bug 24754
UserEnv not set for ISLDI requests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24754: Simplify tests
Bug-24754-Simplify-tests.patch (text/plain), 5.14 KB, created by
Jonathan Druart
on 2020-03-03 13:26:43 UTC
(
hide
)
Description:
Bug 24754: Simplify tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-03 13:26:43 UTC
Size:
5.14 KB
patch
obsolete
>From ec0c3424b01686033975f9d05aac6fb05d5f7f4c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 3 Mar 2020 14:22:06 +0100 >Subject: [PATCH] Bug 24754: Simplify tests > >--- > t/db_dependent/Circulation/issue.t | 87 +++++++++++------------------- > 1 file changed, 32 insertions(+), 55 deletions(-) > >diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t >index 34c89ef3ee..c45e9a1e4b 100644 >--- a/t/db_dependent/Circulation/issue.t >+++ b/t/db_dependent/Circulation/issue.t >@@ -36,6 +36,7 @@ use Koha::Items; > use Koha::Library; > use Koha::Patrons; > use Koha::CirculationRules; >+use Koha::Statistics; > > BEGIN { > require_ok('C4::Circulation'); >@@ -248,61 +249,37 @@ subtest 'Show that AddRenewal respects OpacRenewalBranch and interface' => sub { > > $se->mock( 'interface', sub { return 'opac' } ); > >- t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'opacrenew' ); >- my $item = $builder->build_sample_item({ itype => $itemtype}); >- my $opac_renew_issue = C4::Circulation::AddIssue( $borrower_1, $item->barcode ); >- AddRenewal( >- $borrower_id1, >- $item->itemnumber, >- "Stavromula", $datedue1, $daysago10 >- ); >- my $stat = $schema->resultset('Statistic')->search({ itemnumber => $item->itemnumber, type => 'renew' })->next; >- is( $stat->branch, "OPACRenew", "OpacRenewalBranch is respected for OpacRenewalBranch = OPACRenew" ); >- >- t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'checkoutbranch' ); >- my $item2 = $builder->build_sample_item({ itype => $itemtype}); >- $opac_renew_issue = C4::Circulation::AddIssue( $borrower_1, $item2->barcode ); >- AddRenewal( >- $borrower_id1, >- $item2->itemnumber, >- "Stavromula", $datedue1, $daysago10 >- ); >- $stat = $schema->resultset('Statistic')->search({ itemnumber => $item2->itemnumber, type => 'renew' })->next; >- is( $stat->branch, $patron_1->branchcode, "OpacRenewalBranch is respected for OpacRenewalBranch = checkoutbranch" ); >- >- t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'patronhomebranch' ); >- my $item3 = $builder->build_sample_item({ itype => $itemtype}); >- $opac_renew_issue = C4::Circulation::AddIssue( $borrower_1, $item3->barcode ); >- AddRenewal( >- $borrower_id1, >- $item3->itemnumber, >- "Stavromula", $datedue1, $daysago10 >- ); >- $stat = $schema->resultset('Statistic')->search({ itemnumber => $item3->itemnumber, type => 'renew' })->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' ); >- my $item4 = $builder->build_sample_item({ itype => $itemtype}); >- $opac_renew_issue = C4::Circulation::AddIssue( $borrower_1, $item4->barcode ); >- AddRenewal( >- $borrower_id1, >- $item4->itemnumber, >- "Stavromula", $datedue1, $daysago10 >- ); >- $stat = $schema->resultset('Statistic')->search({ itemnumber => $item4->itemnumber, type => 'renew' })->next; >- is( $stat->branch, $item4->homebranch, "OpacRenewalBranch is respected for OpacRenewalBranch = itemhomebranch" ); >- >- t::lib::Mocks::mock_preference( 'OpacRenewalBranch', 'none' ); >- my $item5 = $builder->build_sample_item({ itype => $itemtype}); >- $opac_renew_issue = C4::Circulation::AddIssue( $borrower_1, $item5->barcode ); >- AddRenewal( >- $borrower_id1, >- $item5->itemnumber, >- "Stavromula", $datedue1, $daysago10 >- ); >- $stat = $schema->resultset('Statistic')->search({ itemnumber => $item5->itemnumber, type => 'renew' })->next; >- is( $stat->branch, "", "OpacRenewalBranch is respected for OpacRenewalBranch none" ); >+ my $item_library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $logged_in_user = $builder->build_object( { class => 'Koha::Patrons' } ); >+ t::lib::Mocks::mock_userenv( { patron => $logged_in_user } ); >+ >+ my $OpacRenewalBranch = { >+ opacrenew => "OPACRenew", >+ checkoutbranch => $logged_in_user->branchcode, >+ patronhomebranch => $patron->branchcode, >+ itemhomebranch => $item_library->branchcode, >+ none => "", >+ }; >+ >+ while ( my ( $syspref, $expected_branchcode ) = each %$OpacRenewalBranch ) { >+ >+ t::lib::Mocks::mock_preference( 'OpacRenewalBranch', $syspref ); >+ >+ my $item = $builder->build_sample_item( >+ { library => $item_library->branchcode, itype => $itemtype } ); >+ my $opac_renew_issue = >+ C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); >+ >+ AddRenewal( $patron->borrowernumber, $item->itemnumber, >+ "Stavromula", $datedue1, $daysago10 ); >+ >+ my $stat = Koha::Statistics->search( >+ { itemnumber => $item->itemnumber, type => 'renew' } )->next; >+ is( $stat->branch, $expected_branchcode, >+ "->renewal_branchcode is respected for OpacRenewalBranch = $syspref" >+ ); >+ } > }; > > #Test GetBiblioIssues >-- >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 24754
:
99768
|
99772
|
99773
|
99778
|
100000
|
100001
|
100006
|
100035
|
100269
|
100305
|
101094
|
101584
|
101585