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

(-)a/t/db_dependent/Circulation/AnonymiseIssueHistory.t (-2 / +27 lines)
Lines 164-170 subtest 'AnonymousPatron is not defined' => sub { Link Here
164
};
164
};
165
165
166
subtest 'Test StoreLastBorrower' => sub {
166
subtest 'Test StoreLastBorrower' => sub {
167
    plan tests => 4;
167
    plan tests => 6;
168
168
169
    t::lib::Mocks::mock_preference( 'StoreLastBorrower', '1' );
169
    t::lib::Mocks::mock_preference( 'StoreLastBorrower', '1' );
170
170
Lines 241-246 subtest 'Test StoreLastBorrower' => sub { Link Here
241
    my $patron_object2 = $item_object->last_returned_by();
241
    my $patron_object2 = $item_object->last_returned_by();
242
    is( $patron_object->id, $patron_object2->id,
242
    is( $patron_object->id, $patron_object2->id,
243
        'Calling last_returned_by with Borrower object sets last_returned_by to that borrower' );
243
        'Calling last_returned_by with Borrower object sets last_returned_by to that borrower' );
244
245
    $patron_object->delete;
246
    $item_object = Koha::Items->find( $item->{itemnumber} );
247
    is( $item_object->last_returned_by, undef, 'last_returned_by should return undef if the last patron to return the item has been deleted' );
248
249
    t::lib::Mocks::mock_preference( 'StoreLastBorrower', '0' );
250
    $patron = $builder->build(
251
        {
252
            source => 'Borrower',
253
            value  => { privacy => 1, }
254
        }
255
    );
256
257
    $issue = $builder->build(
258
        {
259
            source => 'Issue',
260
            value  => {
261
                borrowernumber => $patron->{borrowernumber},
262
                itemnumber     => $item->{itemnumber},
263
            },
264
        }
265
    );
266
    ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' );
267
268
    $item_object   = Koha::Items->find( $item->{itemnumber} );
269
    is( $item_object->last_returned_by, undef, 'Last patron to return item should not be stored if StoreLastBorrower if off' );
244
};
270
};
245
271
246
$schema->storage->txn_rollback;
272
$schema->storage->txn_rollback;
247
- 

Return to bug 14945