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

(-)a/t/db_dependent/Circulation/ReturnClaims.t (-2 / +31 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 3;
20
use Test::More tests => 4;
21
use Test::MockModule;
21
use Test::MockModule;
22
use Test::Warn;
22
use Test::Warn;
23
23
Lines 143-146 subtest 'Test Koha::Checkout::claim_returned, mark as returned' => sub { Link Here
143
    is( $checkout2->id, $checkout->id, "Checkout was found in the old_issues table");
143
    is( $checkout2->id, $checkout->id, "Checkout was found in the old_issues table");
144
};
144
};
145
145
146
subtest 'Test Koha::Checkout::claim_returned should not update the itemlost status if it is already set' => sub {
147
    plan tests => 2;
148
149
    t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 );
150
    my $item     = $builder->build_sample_item( { itemlost => 0 } );
151
    my $patron   = $builder->build_object( { class => 'Koha::Patrons' } );
152
    my $checkout = AddIssue( $patron, $item->barcode );
153
154
    my $claim = $checkout->claim_returned(
155
        {
156
            created_by => $patron->borrowernumber,
157
            notes      => "Test note",
158
        }
159
    );
160
    my $updated_item = Koha::Items->find( $item->id );
161
    is( $updated_item->itemlost, 1, 'Itemlost was set by the return claim' );
162
163
    my $item2     = $builder->build_sample_item( { itemlost => 2 } );
164
    my $checkout2 = AddIssue( $patron, $item->barcode );
165
166
    my $claim2 = $checkout2->claim_returned(
167
        {
168
            created_by => $patron->borrowernumber,
169
            notes      => "Test note",
170
        }
171
    );
172
    my $updated_item2 = Koha::Items->find( $item2->id );
173
    is( $updated_item2->itemlost, 2, 'Itemlost was not set by the return claim as it already has an Itemlost status' );
174
};
175
146
$schema->storage->txn_rollback;
176
$schema->storage->txn_rollback;
147
- 

Return to bug 27919