Bug 32496: Fix tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
e9d8cc08c5
commit
d550bcd909
|
|
@ -47,7 +47,7 @@ sub do_renew_for {
|
|||
|
||||
}
|
||||
if ($renewokay){
|
||||
my $issue = AddIssue( $patron->unblessed, $self->{item}->id, undef, 0 );
|
||||
my $issue = AddIssue( $patron, $self->{item}->id, undef, 0 );
|
||||
$self->{due} = $self->duedatefromissue($issue, $self->{item}->{itemnumber});
|
||||
$self->renewal_ok(1);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -455,8 +455,8 @@ subtest 'SearchItems test' => sub {
|
|||
is($total_results, 1, 'found all items of library1 with new_status=0 with ifnull = 0');
|
||||
|
||||
t::lib::Mocks::mock_userenv({ branchcode => $item1->homebranch });
|
||||
my $patron_borrower = $builder->build_object({ class => 'Koha::Patrons' })->unblessed;
|
||||
AddIssue( $patron_borrower, $item1->barcode );
|
||||
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
|
||||
AddIssue( $patron, $item1->barcode );
|
||||
# Search item where item is checked out
|
||||
$filter = {
|
||||
conjunction => 'AND',
|
||||
|
|
|
|||
|
|
@ -698,7 +698,7 @@ subtest 'cancel() tests' => sub {
|
|||
t::lib::Mocks::mock_userenv({ patron => $patron });
|
||||
|
||||
# Add a checkout so deleting the item fails because od 'book_on_loan'
|
||||
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode );
|
||||
C4::Circulation::AddIssue( $patron, $item->barcode );
|
||||
|
||||
my $result = $order->cancel({ reason => $reason });
|
||||
# refresh the order object
|
||||
|
|
@ -966,7 +966,7 @@ subtest 'cancel() tests' => sub {
|
|||
$order->add_item( $item_3->id );
|
||||
|
||||
# Add a checkout so deleting the item fails because od 'book_on_loan'
|
||||
C4::Circulation::AddIssue( $patron->unblessed, $item_2->barcode );
|
||||
C4::Circulation::AddIssue( $patron, $item_2->barcode );
|
||||
C4::Reserves::AddReserve(
|
||||
{
|
||||
branchcode => $item_3->holdingbranch,
|
||||
|
|
|
|||
|
|
@ -483,7 +483,7 @@ subtest 'get_items_that_can_fill' => sub {
|
|||
);
|
||||
|
||||
# item 3 is on loan
|
||||
AddIssue( $patron_3->unblessed, $item_3->barcode );
|
||||
AddIssue( $patron_3, $item_3->barcode );
|
||||
|
||||
# item 4 is in transfer
|
||||
my $from = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
|
|
|
|||
|
|
@ -263,14 +263,14 @@ subtest 'add_to_bundle tests' => sub {
|
|||
'Koha::Exceptions::Item::Bundle::IsBundle',
|
||||
'Exception thrown if you try to add a bundle host to a bundle item';
|
||||
|
||||
C4::Circulation::AddIssue( $patron->unblessed, $host_item->barcode );
|
||||
C4::Circulation::AddIssue( $patron, $host_item->barcode );
|
||||
throws_ok { $host_item->add_to_bundle($bundle_item2) }
|
||||
'Koha::Exceptions::Item::Bundle::BundleIsCheckedOut',
|
||||
'Exception thrown if you try to add an item to a checked out bundle';
|
||||
C4::Circulation::AddReturn( $host_item->barcode, $host_item->homebranch );
|
||||
$host_item->discard_changes;
|
||||
|
||||
C4::Circulation::AddIssue( $patron->unblessed, $bundle_item2->barcode );
|
||||
C4::Circulation::AddIssue( $patron, $bundle_item2->barcode );
|
||||
throws_ok { $host_item->add_to_bundle($bundle_item2) }
|
||||
'Koha::Exceptions::Item::Bundle::ItemIsCheckedOut',
|
||||
'Exception thrown if you try to add a checked out item';
|
||||
|
|
@ -304,7 +304,7 @@ subtest 'remove_from_bundle tests' => sub {
|
|||
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
|
||||
t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } );
|
||||
|
||||
C4::Circulation::AddIssue( $patron->unblessed, $host_item->barcode );
|
||||
C4::Circulation::AddIssue( $patron, $host_item->barcode );
|
||||
throws_ok { $bundle_item1->remove_from_bundle }
|
||||
'Koha::Exceptions::Item::Bundle::BundleIsCheckedOut',
|
||||
'Exception thrown if you try to add an item to a checked out bundle';
|
||||
|
|
@ -871,7 +871,7 @@ subtest 'deletion' => sub {
|
|||
$item = $builder->build_sample_item({ library => $library->branchcode });
|
||||
|
||||
# book_on_loan
|
||||
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode );
|
||||
C4::Circulation::AddIssue( $patron, $item->barcode );
|
||||
|
||||
is(
|
||||
@{$item->safe_to_delete->messages}[0]->message,
|
||||
|
|
@ -1973,7 +1973,7 @@ subtest 'Recalls tests' => sub {
|
|||
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall item if not checked out" );
|
||||
|
||||
$item1->update({ withdrawn => 0 });
|
||||
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode );
|
||||
C4::Circulation::AddIssue( $patron2, $item1->barcode );
|
||||
|
||||
Koha::CirculationRules->set_rules({
|
||||
branchcode => $branchcode,
|
||||
|
|
@ -2023,7 +2023,7 @@ subtest 'Recalls tests' => sub {
|
|||
C4::Circulation::AddReturn( $item1->barcode, $branchcode );
|
||||
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall if no items are checked out" );
|
||||
|
||||
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode );
|
||||
C4::Circulation::AddIssue( $patron2, $item1->barcode );
|
||||
is( $item1->can_be_recalled({ patron => $patron1 }), 1, "Can recall item" );
|
||||
|
||||
$recall1 = Koha::Recall->new(
|
||||
|
|
@ -2168,7 +2168,7 @@ subtest 'has_pending_recall() tests' => sub {
|
|||
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode });
|
||||
t::lib::Mocks::mock_preference( 'UseRecalls', 1 );
|
||||
|
||||
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode );
|
||||
C4::Circulation::AddIssue( $patron, $item->barcode );
|
||||
|
||||
my ($recall) = Koha::Recalls->add_recall({ biblio => $item->biblio, item => $item, patron => $patron });
|
||||
|
||||
|
|
|
|||
|
|
@ -1504,8 +1504,8 @@ subtest 'get_savings tests' => sub {
|
|||
|
||||
is( $patron->get_savings, 0, 'No checkouts with itemnumber, no savings' );
|
||||
|
||||
AddIssue( $patron->unblessed, $item1->barcode );
|
||||
AddIssue( $patron->unblessed, $item2->barcode );
|
||||
AddIssue( $patron, $item1->barcode );
|
||||
AddIssue( $patron, $item2->barcode );
|
||||
|
||||
my $savings = $patron->get_savings;
|
||||
is( $savings + 0, $item1->replacementprice + $item2->replacementprice, "Savings correctly calculated from current issues" );
|
||||
|
|
|
|||
|
|
@ -345,7 +345,7 @@ subtest renew => sub {
|
|||
}
|
||||
);
|
||||
|
||||
AddIssue( $patron->unblessed, $item->barcode, undef, 0 );
|
||||
AddIssue( $patron, $item->barcode, undef, 0 );
|
||||
my $checkout = $item->checkout;
|
||||
ok( defined($checkout), "Successfully checked out an item prior to renewal" );
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue