Bug 21065: Add tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> (cherry picked from commit09ef91653b) Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (cherry picked from commit554cee5b3c) Conflicts: t/db_dependent/Koha/Account/Lines.t Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
61784f5e26
commit
a630acd720
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 2;
|
||||
use Test::More tests => 3;
|
||||
|
||||
use Koha::Account::Lines;
|
||||
use Koha::Items;
|
||||
|
|
@ -128,3 +128,30 @@ subtest 'total_outstanding' => sub {
|
|||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
||||
subtest 'Keep account info when a patron is deleted' => sub {
|
||||
|
||||
plan tests => 2;
|
||||
|
||||
$schema->storage->txn_begin;
|
||||
|
||||
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
|
||||
my $item = $builder->build_object({ class => 'Koha::Items' });
|
||||
my $line = Koha::Account::Line->new(
|
||||
{
|
||||
borrowernumber => $patron->borrowernumber,
|
||||
itemnumber => $item->itemnumber,
|
||||
accounttype => "F",
|
||||
amount => 10,
|
||||
})->store;
|
||||
|
||||
$item->delete;
|
||||
$line = $line->get_from_storage;
|
||||
is( $line->itemnumber, undef, "The account line should not be deleted when the related item is delete");
|
||||
|
||||
$patron->delete;
|
||||
$line = $line->get_from_storage;
|
||||
is( $line->borrowernumber, undef, "The account line should not be deleted when the related patron is delete");
|
||||
|
||||
$schema->storage->txn_rollback;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue