View | Details | Raw Unified | Return to bug 24598
Collapse All | Expand All

(-)a/t/db_dependent/Circulation.t (-2 / +59 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 49;
21
use Test::More tests => 50;
22
use Test::MockModule;
22
use Test::MockModule;
23
use Test::Deep qw( cmp_deeply );
23
use Test::Deep qw( cmp_deeply );
24
24
Lines 4443-4448 subtest 'Tests for NoRefundOnLostReturnedItemsAge with AddIssue' => sub { Link Here
4443
    };
4443
    };
4444
};
4444
};
4445
4445
4446
subtest 'Checkout should correctly terminate a transfer' => sub {
4447
    plan tests => 7;
4448
4449
    my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } );
4450
    my $patron_1 = $builder->build_object(
4451
        {
4452
            class => 'Koha::Patrons',
4453
            value => { branchcode => $library_1->branchcode }
4454
        }
4455
    );
4456
    my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } );
4457
    my $patron_2 = $builder->build_object(
4458
        {
4459
            class => 'Koha::Patrons',
4460
            value => { branchcode => $library_2->branchcode }
4461
        }
4462
    );
4463
4464
    my $item = $builder->build_sample_item(
4465
        {
4466
            library => $library_1->branchcode,
4467
        }
4468
    );
4469
4470
    t::lib::Mocks::mock_userenv( { branchcode => $library_1->branchcode } );
4471
    my $reserve_id = AddReserve(
4472
        {
4473
            branchcode     => $library_2->branchcode,
4474
            borrowernumber => $patron_2->borrowernumber,
4475
            biblionumber   => $item->biblionumber,
4476
            itemnumber     => $item->itemnumber,
4477
            priority       => 1,
4478
        }
4479
    );
4480
4481
    my $do_transfer = 1;
4482
    ModItemTransfer( $item->itemnumber, $library_1->branchcode,
4483
        $library_2->branchcode );
4484
    ModReserveAffect( $item->itemnumber, undef, $do_transfer, $reserve_id );
4485
    GetOtherReserves( $item->itemnumber )
4486
      ;    # To put the Reason, it's what does returns.pl...
4487
    my $hold = Koha::Holds->find($reserve_id);
4488
    is( $hold->found, 'T', 'Hold is in transit' );
4489
    my $transfer = $item->get_transfer;
4490
    is( $transfer->frombranch, $library_1->branchcode );
4491
    is( $transfer->tobranch,   $library_2->branchcode );
4492
    is( $transfer->reason,     'Reserve' );
4493
4494
    t::lib::Mocks::mock_userenv( { branchcode => $library_2->branchcode } );
4495
    AddIssue( $patron_1->unblessed, $item->barcode );
4496
    $transfer = $transfer->get_from_storage;
4497
    isnt( $transfer->datearrived, undef );
4498
    $hold = $hold->get_from_storage;
4499
    is( $hold->found, undef, 'Hold is waiting' );
4500
    is( $hold->priority, 1, );
4501
};
4502
4503
4446
$schema->storage->txn_rollback;
4504
$schema->storage->txn_rollback;
4447
C4::Context->clear_syspref_cache();
4505
C4::Context->clear_syspref_cache();
4448
$branches = Koha::Libraries->search();
4506
$branches = Koha::Libraries->search();
4449
- 

Return to bug 24598