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

(-)a/t/db_dependent/Koha/Account/Lines.t (-3 / +9 lines)
Lines 323-331 subtest 'apply() tests' => sub { Link Here
323
    $schema->storage->txn_rollback;
323
    $schema->storage->txn_rollback;
324
};
324
};
325
325
326
subtest 'Keep account info when related patron, staff or item is deleted' => sub {
326
subtest 'Keep account info when related patron, staff, item or cash_register is deleted' => sub {
327
327
328
    plan tests => 3;
328
    plan tests => 4;
329
329
330
    $schema->storage->txn_begin;
330
    $schema->storage->txn_begin;
331
331
Lines 338-343 subtest 'Keep account info when related patron, staff or item is deleted' => sub Link Here
338
            value => { itemnumber => $item->itemnumber }
338
            value => { itemnumber => $item->itemnumber }
339
        }
339
        }
340
    );
340
    );
341
    my $register = $builder->build_object({ class => 'Koha::Cash::Registers' });
342
341
    my $line = Koha::Account::Line->new(
343
    my $line = Koha::Account::Line->new(
342
    {
344
    {
343
        borrowernumber => $patron->borrowernumber,
345
        borrowernumber => $patron->borrowernumber,
Lines 347-352 subtest 'Keep account info when related patron, staff or item is deleted' => sub Link Here
347
        status         => "RETURNED",
349
        status         => "RETURNED",
348
        amount         => 10,
350
        amount         => 10,
349
        interface      => 'commandline',
351
        interface      => 'commandline',
352
        register_id    => $register->id
350
    })->store;
353
    })->store;
351
354
352
    $issue->delete;
355
    $issue->delete;
Lines 362-367 subtest 'Keep account info when related patron, staff or item is deleted' => sub Link Here
362
    $line = $line->get_from_storage;
365
    $line = $line->get_from_storage;
363
    is( $line->borrowernumber, undef, "The account line should not be deleted when the related patron is delete");
366
    is( $line->borrowernumber, undef, "The account line should not be deleted when the related patron is delete");
364
367
368
    $register->delete;
369
    $line = $line->get_from_storage;
370
    is( $line->register_id, undef, "The account line should not be deleted when the related cash register is delete");
371
365
    $schema->storage->txn_rollback;
372
    $schema->storage->txn_rollback;
366
};
373
};
367
374
368
- 

Return to bug 23355