From b449a619b86dd47ff5d835b14e1b824c961e9aeb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 10 Jun 2016 15:11:51 +0100 Subject: [PATCH] Bug 16500: Do not try to insert MPL if already exists --- t/db_dependent/TestBuilder.t | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t index 724f32d..dc9d121 100644 --- a/t/db_dependent/TestBuilder.t +++ b/t/db_dependent/TestBuilder.t @@ -24,6 +24,7 @@ use Test::Warn; use Data::Dumper qw(Dumper); use Koha::Database; +use Koha::Libraries; BEGIN { use_ok('t::lib::TestBuilder'); @@ -53,7 +54,9 @@ subtest 'Start with some trivial tests' => sub { # return undef if a record exists my $param = { source => 'Branch', value => { branchcode => 'MPL' } }; - $builder->build( $param ); # at least it should exist now + unless ( Koha::Libraries->find( 'MPL' ) ) { + $builder->build( $param ); # at least it should exist now + } warning_like { $builder->build( $param ) } qr/Violation of unique constraint/, 'Catch warn on adding existing record'; -- 2.8.1