X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;ds=sidebyside;f=t%2Fdb_dependent%2FHolds%2FRevertWaitingStatus.t;h=513eb523458a295b9a0dc7c3f5171c7e08d32d24;hb=7ce858491b86b6fe4f85c0cb5e50f66288c474b0;hp=a7648fd0786e4a7afc83b25c0a011c16ead27598;hpb=76f16b1b42ded69fb9c9672bbeb7a92203783fe5;p=srvgit diff --git a/t/db_dependent/Holds/RevertWaitingStatus.t b/t/db_dependent/Holds/RevertWaitingStatus.t index a7648fd078..513eb52345 100755 --- a/t/db_dependent/Holds/RevertWaitingStatus.t +++ b/t/db_dependent/Holds/RevertWaitingStatus.t @@ -13,35 +13,38 @@ use C4::Items; use C4::Members; use C4::Reserves; -my $dbh = C4::Context->dbh; +use t::lib::TestBuilder; -# Start transaction -$dbh->{AutoCommit} = 0; +my $schema = Koha::Database->schema; +$schema->storage->txn_begin; +my $builder = t::lib::TestBuilder->new; +my $dbh = C4::Context->dbh; $dbh->{RaiseError} = 1; $dbh->do("DELETE FROM reserves"); $dbh->do("DELETE FROM old_reserves"); +my $library = $builder->build({ + source => 'Branch', +}); + local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /redefined/ }; *C4::Context::userenv = \&Mock_userenv; sub Mock_userenv { - my $userenv = { flags => 1, id => '1', branch => 'CPL' }; + my $userenv = { flags => 1, id => '1', branch => $library->{branchcode} }; return $userenv; } my $borrowers_count = 3; -# Setup Test------------------------ -# Helper biblio. -diag("Creating biblio instance for testing."); +# Create a biblio instance my ( $bibnum, $title, $bibitemnum ) = create_helper_biblio(); -# Helper item for that biblio. -diag("Creating item instance for testing."); +# Create an item my $item_barcode = 'my_barcode'; my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem( - { homebranch => 'CPL', holdingbranch => 'CPL', barcode => $item_barcode }, + { homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, barcode => $item_barcode }, $bibnum ); # Create some borrowers @@ -51,7 +54,7 @@ foreach my $i ( 1 .. $borrowers_count ) { firstname => 'my firstname', surname => 'my surname ' . $i, categorycode => 'S', - branchcode => 'CPL', + branchcode => $library->{branchcode}, ); push @borrowernumbers, $borrowernumber; }