|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 4; |
22 |
use Test::More tests => 5; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
|
24 |
|
| 25 |
use Koha::Account; |
25 |
use Koha::Account; |
|
Lines 268-270
subtest 'apply() tests' => sub {
Link Here
|
| 268 |
|
268 |
|
| 269 |
$schema->storage->txn_rollback; |
269 |
$schema->storage->txn_rollback; |
| 270 |
}; |
270 |
}; |
| 271 |
- |
271 |
|
|
|
272 |
subtest 'Keep account info when a patron is deleted' => sub { |
| 273 |
|
| 274 |
plan tests => 2; |
| 275 |
|
| 276 |
$schema->storage->txn_begin; |
| 277 |
|
| 278 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 279 |
my $item = $builder->build_object({ class => 'Koha::Items' }); |
| 280 |
my $line = Koha::Account::Line->new( |
| 281 |
{ |
| 282 |
borrowernumber => $patron->borrowernumber, |
| 283 |
itemnumber => $item->itemnumber, |
| 284 |
accounttype => "F", |
| 285 |
amount => 10, |
| 286 |
})->store; |
| 287 |
|
| 288 |
$item->delete; |
| 289 |
$line = $line->get_from_storage; |
| 290 |
is( $line->itemnumber, undef, "The account line should not be deleted when the related item is delete"); |
| 291 |
|
| 292 |
$patron->delete; |
| 293 |
$line = $line->get_from_storage; |
| 294 |
is( $line->borrowernumber, undef, "The account line should not be deleted when the related patron is delete"); |
| 295 |
|
| 296 |
$schema->storage->txn_rollback; |
| 297 |
}; |
| 298 |
|