Bugzilla – Attachment 87764 Details for
Bug 22688
TT plugin for pickup locations code wrong
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22688: Unit tests
Bug-22688-Unit-tests.patch (text/plain), 2.87 KB, created by
Kyle M Hall
on 2019-04-11 13:54:32 UTC
(
hide
)
Description:
Bug 22688: Unit tests
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2019-04-11 13:54:32 UTC
Size:
2.87 KB
patch
obsolete
>From aa8ed08a71ab3ef3338ac813a044bc0eaac73392 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 11 Apr 2019 09:51:20 -0400 >Subject: [PATCH] Bug 22688: Unit tests > >--- > t/db_dependent/Koha/Libraries.t | 28 ++++++++++++++++++++++++++-- > 1 file changed, 26 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Libraries.t b/t/db_dependent/Koha/Libraries.t >index 5c356c1998..9cd78afa99 100644 >--- a/t/db_dependent/Koha/Libraries.t >+++ b/t/db_dependent/Koha/Libraries.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 7; >+use Test::More tests => 8; > > use C4::Biblio; > use C4::Context; >@@ -35,6 +35,8 @@ use Koha::Database; > use t::lib::Mocks; > use t::lib::TestBuilder; > >+use_ok('Koha::Template::Plugin::Branches'); >+ > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > >@@ -115,7 +117,7 @@ subtest 'pickup_locations' => sub { > my $itemtype = $biblio->itemtype; > > subtest 'UseBranchTransferLimits = OFF' => sub { >- plan tests => 5; >+ plan tests => 10; > > t::lib::Mocks::mock_preference('UseBranchTransferLimits', 0); > t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype'); >@@ -148,6 +150,28 @@ subtest 'pickup_locations' => sub { > $pickup = Koha::Libraries->pickup_locations({ biblio => $bibnum }); > is(@{$pickup}, $total_pickup, '...as well as when ' > .'BranchTransferLimitsType = ccode'); >+ >+ # Test TT plugin >+ $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum }); >+ is(C4::Context->preference('UseBranchTransferLimits'), 0, 'Given system ' >+ .'preference UseBranchTransferLimits is switched OFF,'); >+ is(@{$pickup}, $total_pickup, 'Then the total number of pickup locations ' >+ .'equal number of libraries with pickup_location => 1'); >+ >+ t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'itemtype'); >+ t::lib::Mocks::mock_preference('item-level_itypes', 1); >+ $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum }); >+ is(@{$pickup}, $total_pickup, '...when ' >+ .'BranchTransferLimitsType = itemtype and item-level_itypes = 1'); >+ t::lib::Mocks::mock_preference('item-level_itypes', 0); >+ $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum }); >+ is(@{$pickup}, $total_pickup, '...as well as when ' >+ .'BranchTransferLimitsType = itemtype and item-level_itypes = 0'); >+ t::lib::Mocks::mock_preference('BranchTransferLimitsType', 'ccode'); >+ $pickup = Koha::Template::Plugin::Branches::pickup_locations({ biblio => $bibnum }); >+ is(@{$pickup}, $total_pickup, '...as well as when ' >+ .'BranchTransferLimitsType = ccode'); >+ > t::lib::Mocks::mock_preference('item-level_itypes', 1); > }; > >-- >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 22688
:
87764
|
87765
|
87766
|
87768
|
87772
|
87773
|
87817
|
87818
|
87819
|
87820
|
87884
|
87885
|
87886
|
87887
|
87888