Bug 33641: (follow-up) Fix unit tests
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
26e5852890
commit
16d04b16b7
|
|
@ -292,6 +292,8 @@ $query =
|
|||
$dbh->do( $query, {}, $borrower_id1, $item_id1, $samplebranch1->{branchcode} );
|
||||
|
||||
t::lib::Mocks::mock_preference( 'CataloguingLog', 1 );
|
||||
t::lib::Mocks::mock_userenv( { branchcode => $samplebranch2->{branchcode} } );
|
||||
|
||||
my $log_count_before = $schema->resultset('ActionLog')->search({module => 'CATALOGUING'})->count();
|
||||
my ($doreturn, $messages, $iteminformation, $borrower) = AddReturn('barcode_1',
|
||||
$samplebranch2->{branchcode});
|
||||
|
|
|
|||
|
|
@ -38,10 +38,11 @@ subtest 'Test StoreLastBorrower' => sub {
|
|||
|
||||
t::lib::Mocks::mock_preference( 'StoreLastBorrower', '1' );
|
||||
|
||||
my $patron = $builder->build(
|
||||
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
my $patron = $builder->build(
|
||||
{
|
||||
source => 'Borrower',
|
||||
value => { privacy => 1, }
|
||||
value => { privacy => 1, branchcode => $library->branchcode }
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -57,6 +58,8 @@ subtest 'Test StoreLastBorrower' => sub {
|
|||
}
|
||||
);
|
||||
|
||||
t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } );
|
||||
|
||||
$item = $item->get_from_storage;
|
||||
my $patron_object = $item->last_returned_by();
|
||||
is( $patron_object, undef, 'Koha::Item::last_returned_by returned undef' );
|
||||
|
|
|
|||
|
|
@ -394,6 +394,7 @@ subtest 'apply() tests' => sub {
|
|||
is( $messages[0]->payload->{success}, 1, "'success' key in payload" );
|
||||
|
||||
t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', 'onpayment');
|
||||
t::lib::Mocks::mock_userenv( { branchcode => $library->id } );
|
||||
my $loser = $builder->build_object( { class => 'Koha::Patrons' } );
|
||||
my $loser_account = $loser->account;
|
||||
|
||||
|
|
@ -443,8 +444,6 @@ subtest 'apply() tests' => sub {
|
|||
|
||||
is( $loser->checkouts->next, undef, "Item has been returned");
|
||||
|
||||
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -165,6 +165,8 @@ subtest 'patron' => sub {
|
|||
}
|
||||
)->store;
|
||||
|
||||
t::lib::Mocks::mock_userenv( { branchcode => $library->{branchcode} } );
|
||||
|
||||
my $p = $checkout->patron;
|
||||
is( ref($p), 'Koha::Patron',
|
||||
'Koha::Checkout->patron should return a Koha::Patron' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue