From b70ad9eccd1bff370fa32b5dbc900f05021052ca Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Mon, 2 Jul 2018 10:41:24 +0200
Subject: [PATCH] Bug 20900: Add CPL branch in t_Batch.t too
Content-Type: text/plain; charset=utf-8

Same fix as previous patch.

Test plan:
Run t/db_dependent/Labels/t_Batch.t (without CPL branch)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
---
 t/db_dependent/Labels/t_Batch.t | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/t/db_dependent/Labels/t_Batch.t b/t/db_dependent/Labels/t_Batch.t
index 117a330..ed8c8e8 100644
--- a/t/db_dependent/Labels/t_Batch.t
+++ b/t/db_dependent/Labels/t_Batch.t
@@ -21,11 +21,15 @@
 use Modern::Perl;
 
 use Test::More tests => 24;
-use C4::Context;
 use MARC::Record;
 use MARC::Field;
+
+use t::lib::TestBuilder;
+
+use C4::Context;
 use C4::Biblio;
 use C4::Items;
+use Koha::Libraries;
 
 BEGIN {
     use_ok('C4::Labels::Batch');
@@ -36,6 +40,10 @@ my $dbh = C4::Context->dbh;
 $dbh->{AutoCommit} = 0;
 $dbh->{RaiseError} = 1;
 
+my $builder = t::lib::TestBuilder->new;
+$builder->build({ source => 'Branch', value => { branchcode => 'CPL' } })
+    unless Koha::Libraries->find('CPL');
+
 my $sth = $dbh->prepare('SELECT branchcode FROM branches b LIMIT 0,1');
 $sth->execute();
 my $branch_code = $sth->fetchrow_hashref()->{'branchcode'};
-- 
2.1.4