From 1505d475614d0b7268c3504dca2088a5c79812f3 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 27 May 2016 08:35:57 +0200 Subject: [PATCH] Bug 16607: Remove CPL/MPL from two unit tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Both tests pass OK Signed-off-by: Marc VĂ©ron Signed-off-by: Jonathan Druart --- 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 => [ -- 2.8.1