From 63768c982aac92d11cc3c908cfc4fee796a0a2a0 Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Fri, 27 May 2016 08:35:57 +0200
Subject: [PATCH] Bug 16607: Remove CPL/MPL from two unit tests
Content-Type: text/plain; charset=utf-8

Test t/db_dependent/Accounts.t:
This test created a MPL branch, but did not use it any more.

Test t/db_dependent/Items/AutomaticItemModificationByAge.t:
This test still used CPL/MPL branches. Now it uses two new branches.

Test plan:
[1] Run t/db_dependent/Accounts.t.
[2] Run t/db_dependent/Items/AutomaticItemModificationByAge.t.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
---
 t/db_dependent/Accounts.t                             |    4 +---
 t/db_dependent/Items/AutomaticItemModificationByAge.t |   16 ++++++++--------
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t
index 0fb71f2..fb0ffb7 100644
--- a/t/db_dependent/Accounts.t
+++ b/t/db_dependent/Accounts.t
@@ -52,9 +52,7 @@ my $schema  = Koha::Database->new->schema;
 $schema->storage->txn_begin;
 my $dbh = C4::Context->dbh;
 
-# this test needs a MPL branch; also create another one
-my $builder = t::lib::TestBuilder->new();
-$builder->build({ source => 'Branch', value => { branchcode => 'MPL' }});
+my $builder = t::lib::TestBuilder->new;
 my $library = $builder->build({ source => 'Branch' });
 
 $dbh->do(q|DELETE FROM accountlines|);
diff --git a/t/db_dependent/Items/AutomaticItemModificationByAge.t b/t/db_dependent/Items/AutomaticItemModificationByAge.t
index 6d7abe2..05a92ad 100644
--- a/t/db_dependent/Items/AutomaticItemModificationByAge.t
+++ b/t/db_dependent/Items/AutomaticItemModificationByAge.t
@@ -17,11 +17,11 @@ my $dbh = C4::Context->dbh;
 $dbh->{AutoCommit} = 0;
 $dbh->{RaiseError} = 1;
 
-# this test assumes a CPL branch
 my $builder = t::lib::TestBuilder->new;
-if( !$builder->schema->resultset('Branch')->find('CPL') ) {
-    $builder->build( { source => 'Branch', value => { branchcode => 'CPL' }});
-}
+
+# create two branches
+my $library = $builder->build( { source => 'Branch' })->{branchcode};
+my $library2 = $builder->build( { source => 'Branch' })->{branchcode};
 
 $dbh->do(q|
     DELETE FROM marc_subfield_structure
@@ -44,8 +44,8 @@ my ($biblionumber, undef) = C4::Biblio::AddBiblio($record, '');
 
 my ($item_bibnum, $item_bibitemnum, $itemnumber) = C4::Items::AddItem(
     {
-        homebranch => 'CPL',
-        holdingbranch => 'CPL',
+        homebranch => $library,
+        holdingbranch => $library,
         new_status => 'new_value',
         ccode => 'FIC',
     },
@@ -194,7 +194,7 @@ is( $marc_item->subfield($tagfield, $new_tagfield), undef, q|ToggleNewStatus: Th
             },
             {
                 field => 'items.homebranch',
-                value => 'CPL',
+                value => $library,
             },
         ],
         substitutions => [
@@ -248,7 +248,7 @@ is( $modified_item->{new_status}, 'new_value', q|ToggleNewStatus: conditions mul
             },
             {
                 field => 'items.homebranch',
-                value => 'MPL|CPL',
+                value => "$library|$library2",
             },
         ],
         substitutions => [
-- 
1.7.10.4