Bugzilla – Attachment 47764 Details for
Bug 15758
Move the C4::Branch related code to Koha::Libraries - part 4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15758: Koha::Libraries - Add tests for the Branches TT plugin
Bug-15758-KohaLibraries---Add-tests-for-the-Branch.patch (text/plain), 2.70 KB, created by
Jonathan Druart
on 2016-02-08 17:46:32 UTC
(
hide
)
Description:
Bug 15758: Koha::Libraries - Add tests for the Branches TT plugin
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-02-08 17:46:32 UTC
Size:
2.70 KB
patch
obsolete
>From 8fcd160e8644fc31bd57fb089d9ba45b9cddf21e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 8 Feb 2016 15:20:18 +0000 >Subject: [PATCH] Bug 15758: Koha::Libraries - Add tests for the Branches TT > plugin > >--- > t/db_dependent/Koha_template_plugin_Branches.t | 26 +++++++++++++++++++++++++- > 1 file changed, 25 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha_template_plugin_Branches.t b/t/db_dependent/Koha_template_plugin_Branches.t >index af055ad..2241c3a 100644 >--- a/t/db_dependent/Koha_template_plugin_Branches.t >+++ b/t/db_dependent/Koha_template_plugin_Branches.t >@@ -18,7 +18,7 @@ > > use Modern::Perl; > >-use Test::More tests => 7; >+use Test::More tests => 14; > > use C4::Context; > use Koha::Database; >@@ -34,6 +34,15 @@ $schema->storage->txn_begin; > my $builder = t::lib::TestBuilder->new; > my $library = $builder->build({ > source => 'Branch', >+ value => { >+ branchcode => 'MYLIBRARY', >+ } >+}); >+my $another_library = $builder->build({ >+ source => 'Branch', >+ value => { >+ branchcode => 'ANOTHERLIB', >+ } > }); > > my $plugin = Koha::Template::Plugin::Branches->new(); >@@ -55,3 +64,18 @@ C4::Context->_new_userenv('DUMMY_SESSION_ID'); > C4::Context->set_userenv(123, 'userid', 'usercnum', 'First name', 'Surname', 'MYLIBRARY', 'My Library', 0); > $library = $plugin->GetLoggedInBranchcode(); > is($library, 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library'); >+ >+C4::Context->set_preference( 'IndependentBranches', 0 ); >+my $libraries = $plugin->all(); >+ok( scalar(@$libraries) > 1, 'If IndependentBranches is not set, all libraries should be returned' ); >+is( grep ( { $_->{branchcode} eq 'MYLIBRARY' and $_->{selected} == 1 } @$libraries ), 1, 'Without selected parameter, my library should be preselected' ); >+is( grep ( { $_->{branchcode} eq 'ANOTHERLIB' and not exists $_->{selected} } @$libraries ), 1, 'Without selected parameter, other library should not be preselected' ); >+$libraries = $plugin->all( { selected => 'ANOTHERLIB' } ); >+is( grep ( { $_->{branchcode} eq 'MYLIBRARY' and not exists $_->{selected} } @$libraries ), 1, 'With selected parameter, my library should not be preselected' ); >+is( grep ( { $_->{branchcode} eq 'ANOTHERLIB' and $_->{selected} == 1 } @$libraries ), 1, 'With selected parameter, other library should be preselected' ); >+ >+C4::Context->set_preference( 'IndependentBranches', 1 ); >+$libraries = $plugin->all(); >+is( scalar(@$libraries), 1, 'If IndependentBranches is set, only 1 library should be returned' ); >+$libraries = $plugin->all( { unfiltered => 1 } ); >+ok( scalar(@$libraries) > 1, 'If IndependentBranches is set, all libraries should be returned if the unfiltered flag is set' ); >-- >2.1.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 15758
:
47746
|
47747
|
47748
|
47749
|
47750
|
47751
|
47752
|
47753
|
47759
|
47760
|
47761
|
47762
|
47763
|
47764
|
47765
|
52723
|
52724
|
52726
|
52727
|
52728
|
52729
|
52730
|
52731
|
52736
|
52788
|
52789
|
52790
|
52791
|
52792
|
52793
|
52794
|
52795
|
52913
|
52914
|
52915
|
52916
|
52917
|
52918
|
52919
|
52920
|
53893
|
53894
|
53895
|
53896
|
53897
|
53898
|
53899
|
53900
|
53997
|
53998
|
53999
|
54000
|
54001
|
54002
|
54003
|
54004
|
54029
|
54030
|
54031
|
54032
|
54033
|
54034
|
54035
|
54036
|
54037
|
54038
|
54039
|
54040
|
54041
|
54042
|
54043
|
54044
|
54861
|
54862
|
54863
|
54864
|
54865
|
54866
|
54867
|
54868
|
54908
|
54909
|
54921
|
54925
|
55061
|
55062
|
55063
|
55064
|
55065
|
55066
|
55067
|
55068
|
55069
|
55070
|
55071
|
55072
|
55073
|
55346
|
55347
|
55348
|
55349
|
55350
|
55351
|
55352
|
55353
|
55354
|
55355
|
55356
|
55357
|
55358
|
55445