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

(-)a/t/db_dependent/Circulation.t (-2 / +57 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 => 70;
21
use Test::More tests => 72;
22
use Test::Exception;
22
use Test::Exception;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
Lines 2632-2637 subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { Link Here
2632
    # TODO There are other tests to provide here
2632
    # TODO There are other tests to provide here
2633
};
2633
};
2634
2634
2635
subtest "Bug 27753 - Add AutoClaimReturnStatusOnCheckin" => sub {
2636
    plan tests => 8;
2637
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2638
    t::lib::Mocks::mock_userenv({ branchcode => $library2->{branchcode} });
2639
    t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 );
2640
    t::lib::Mocks::mock_preference( 'AutoClaimReturnStatusOnCheckin', 1 );
2641
    my $item = $builder->build_sample_item ({library=>$library2->{branchcode}});
2642
    my $patron   = $builder->build_object( { class => 'Koha::Patrons' } );
2643
    my $checkout = AddIssue( $patron, $item->barcode );
2644
2645
    my $claim = $checkout->claim_returned(
2646
            {
2647
              created_by => $patron->id,
2648
              notes      => "Test note",
2649
            }
2650
        );
2651
    is( $claim->issue_id, $checkout->id, "Claim issue id matches" );
2652
    is( $claim->itemnumber, $item->id, "Claim itemnumber matches" );
2653
    is( $claim->borrowernumber, $patron->id, "Claim borrowernumber matches" );
2654
    is( $claim->notes, "Test note", "Claim notes match" );
2655
    is( $claim->created_by, $patron->id, "Claim created_by matches" );
2656
    ok( $claim->created_on, "Claim created_on is set" );
2657
2658
    my ( $doreturn, $messages) = AddReturn ( $item->barcode, $library->{branchcode} );
2659
    is (ref $messages->{ClaimAutoResolved}, 'Koha::Checkouts::ReturnClaim', "Claim auto resolved upon checkin");
2660
    $claim->discard_changes;
2661
    ok( $claim->resolved_by, "Claim is resolved");
2662
};
2663
2664
subtest "Bug 27753 - Add AutoTestClaimReturnStatusOnCheckin" => sub {
2665
    plan tests => 7;
2666
    t::lib::Mocks::mock_preference( 'AllowReturnToBranch', 'anywhere' );
2667
    t::lib::Mocks::mock_userenv({ branchcode => $library2->{branchcode} });
2668
    t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 );
2669
    t::lib::Mocks::mock_preference( 'AutoClaimReturnStatusOnCheckin', 0 );
2670
    my $item = $builder->build_sample_item ({library=>$library2->{branchcode}});
2671
    my $patron   = $builder->build_object( { class => 'Koha::Patrons' } );
2672
    my $checkout = AddIssue( $patron, $item->barcode );
2673
2674
    my $claim = $checkout->claim_returned(
2675
            {
2676
              created_by => $patron->id,
2677
              notes      => "Test note",
2678
            }
2679
        );
2680
    is( $claim->issue_id, $checkout->id, "Claim issue id matches" );
2681
    is( $claim->itemnumber, $item->id, "Claim itemnumber matches" );
2682
    is( $claim->borrowernumber, $patron->id, "Claim borrowernumber matches" );
2683
    is( $claim->notes, "Test note", "Claim notes match" );
2684
    is( $claim->created_by, $patron->id, "Claim created_by matches" );
2685
    ok( $claim->created_on, "Claim created_on is set" );
2686
2687
    my ( $doreturn, $messages) = AddReturn ( $item->barcode, $library->{branchcode} );
2688
    is (ref $messages->{ReturnClaims}, 'Koha::Checkouts::ReturnClaim', "Claim was returned");
2689
};
2690
2635
subtest 'MultipleReserves' => sub {
2691
subtest 'MultipleReserves' => sub {
2636
    plan tests => 3;
2692
    plan tests => 3;
2637
2693
2638
- 

Return to bug 27753