Bug 16607: Remove CPL/MPL from two unit tests
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 27 May 2016 06:35:57 +0000 (08:35 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 17 Jun 2016 14:44:39 +0000 (14:44 +0000)
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>
Both tests pass OK
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/Accounts.t
t/db_dependent/Items/AutomaticItemModificationByAge.t

index 0fb71f2..fb0ffb7 100644 (file)
@@ -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|);
index 6d7abe2..05a92ad 100644 (file)
@@ -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 => [