Bug 19126: Fix Members.t with IndependentBranches set
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 16 Aug 2017 11:15:19 +0000 (13:15 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 25 Aug 2017 15:12:04 +0000 (12:12 -0300)
If you enabled that pref, Members.t fails with:
t/db_dependent/Members.t .. 63/63 # Looks like you failed 15 tests of 63.

The first one is:
t/db_dependent/Members.t .. 32/63
   Failed test 'Staff patron not deleted from list'
   at t/db_dependent/Members.t line 304.

Bottle neck is GetBorrowersToExpunge. The results of that sub depend on the
state of this preference.
Trivially fixing it here by disabling the pref before the first call.

Test plan:
[1] Do not apply this patch yet. Enable IndependentBranches.
[2] Run Members.t and observe that it fails.
[3] Apply this patch. And run Members.t again. It should pass now.

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Members.t

index f75652c..a933827 100755 (executable)
@@ -293,6 +293,10 @@ $builder->build({
         },
 });
 
+# The following calls to GetBorrowersToExpunge are assuming that the pref
+# IndependentBranches is off.
+t::lib::Mocks::mock_preference('IndependentBranches', 0);
+
 my $owner = AddMember (categorycode => 'STAFFER', branchcode => $library2->{branchcode} );
 my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } );
 my @listpatrons = ($bor1inlist, $bor2inlist);