Bugzilla – Attachment 7443 Details for
Bug 6137
Fix a little bug when userenv is null
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Unit tests for _GetCircControlBranch
0001-Bug-6137-unit-tests-for-C4-Circulation-_GetCircContr.patch (text/plain), 3.58 KB, created by
Julian Maurice
on 2012-02-03 12:58:16 UTC
(
hide
)
Description:
Unit tests for _GetCircControlBranch
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2012-02-03 12:58:16 UTC
Size:
3.58 KB
patch
obsolete
>From badb80985e5169e2f1a8aa4d88ee8c2d05818e9e Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 27 Jan 2012 15:59:36 +0100 >Subject: [PATCH] Bug 6137: unit tests for > C4::Circulation::_GetCircControlBranch > >--- > t/Circulation.t | 110 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 110 insertions(+), 0 deletions(-) > create mode 100755 t/Circulation.t > >diff --git a/t/Circulation.t b/t/Circulation.t >new file mode 100755 >index 0000000..8fab844 >--- /dev/null >+++ b/t/Circulation.t >@@ -0,0 +1,110 @@ >+#!/usr/bin/perl >+ >+use Test::More tests => 15; >+ >+BEGIN { >+ use_ok('C4::Circulation'); >+} >+ >+my $CircControl = C4::Context->preference('CircControl'); >+my $HomeOrHoldingBranch = C4::Context->preference('HomeOrHoldingBranch'); >+ >+my $item = { >+ homebranch => 'ItemHomeBranch', >+ holdingbranch => 'ItemHoldingBranch' >+}; >+ >+my $borrower = { >+ branchcode => 'BorrowerBranch' >+}; >+ >+# No userenv, PickupLibrary >+C4::Context->set_preference('CircControl', 'PickupLibrary'); >+is( >+ C4::Context->preference('CircControl'), >+ 'PickupLibrary', >+ 'CircControl changed to PickupLibrary' >+); >+is( >+ C4::Circulation::_GetCircControlBranch($item, $borrower), >+ $item->{$HomeOrHoldingBranch}, >+ '_GetCircControlBranch returned item branch (no userenv defined)' >+); >+ >+# No userenv, PatronLibrary >+C4::Context->set_preference('CircControl', 'PatronLibrary'); >+is( >+ C4::Context->preference('CircControl'), >+ 'PatronLibrary', >+ 'CircControl changed to PatronLibrary' >+); >+is( >+ C4::Circulation::_GetCircControlBranch($item, $borrower), >+ $borrower->{branchcode}, >+ '_GetCircControlBranch returned borrower branch' >+); >+ >+# No userenv, ItemHomeLibrary >+C4::Context->set_preference('CircControl', 'ItemHomeLibrary'); >+is( >+ C4::Context->preference('CircControl'), >+ 'ItemHomeLibrary', >+ 'CircControl changed to ItemHomeLibrary' >+); >+is( >+ $item->{$HomeOrHoldingBranch}, >+ C4::Circulation::_GetCircControlBranch($item, $borrower), >+ '_GetCircControlBranch returned item branch' >+); >+ >+diag('Now, set a userenv'); >+C4::Context->_new_userenv('xxx'); >+C4::Context::set_userenv(0,0,0,'firstname','surname', 'CurrentBranch', 'CurrentBranchName', '', '', ''); >+is(C4::Context->userenv->{branch}, 'CurrentBranch', 'userenv set'); >+ >+# Userenv set, PickupLibrary >+C4::Context->set_preference('CircControl', 'PickupLibrary'); >+is( >+ C4::Context->preference('CircControl'), >+ 'PickupLibrary', >+ 'CircControl changed to PickupLibrary' >+); >+is( >+ C4::Circulation::_GetCircControlBranch($item, $borrower), >+ 'CurrentBranch', >+ '_GetCircControlBranch returned current branch' >+); >+ >+# Userenv set, PatronLibrary >+C4::Context->set_preference('CircControl', 'PatronLibrary'); >+is( >+ C4::Context->preference('CircControl'), >+ 'PatronLibrary', >+ 'CircControl changed to PatronLibrary' >+); >+is( >+ C4::Circulation::_GetCircControlBranch($item, $borrower), >+ $borrower->{branchcode}, >+ '_GetCircControlBranch returned borrower branch' >+); >+ >+# Userenv set, ItemHomeLibrary >+C4::Context->set_preference('CircControl', 'ItemHomeLibrary'); >+is( >+ C4::Context->preference('CircControl'), >+ 'ItemHomeLibrary', >+ 'CircControl changed to ItemHomeLibrary' >+); >+is( >+ C4::Circulation::_GetCircControlBranch($item, $borrower), >+ $item->{$HomeOrHoldingBranch}, >+ '_GetCircControlBranch returned item branch' >+); >+ >+# Reset initial configuration >+C4::Context->set_preference('CircControl', $CircControl); >+is( >+ C4::Context->preference('CircControl'), >+ $CircControl, >+ 'CircControl reset to its initial value' >+); >-- >1.7.8.3 >
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 6137
:
3829
|
4132
|
7354
|
7443
|
7617