Bugzilla – Attachment 162244 Details for
Bug 22421
accountlines.issue_id is missing a foreign key constraint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22421: Add tests for new constraints
Bug-22421-Add-tests-for-new-constraints.patch (text/plain), 3.60 KB, created by
Victor Grousset/tuxayo
on 2024-02-16 20:48:55 UTC
(
hide
)
Description:
Bug 22421: Add tests for new constraints
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2024-02-16 20:48:55 UTC
Size:
3.60 KB
patch
obsolete
>From fb69020668749f3a5057749fdd14ac1b9a36a8d6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 6 Jun 2019 12:26:47 +0100 >Subject: [PATCH] Bug 22421: Add tests for new constraints > >Test plan: >* Read the updated tests and verify that they make sense and do not >remove anything previously tested for. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > t/db_dependent/Koha/Account/Line.t | 42 +++++++++++++++++++----------- > 1 file changed, 27 insertions(+), 15 deletions(-) > >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index 53e596bc09..c690d38f40 100755 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -25,7 +25,7 @@ use Test::MockModule; > > use DateTime; > >-use C4::Circulation qw( AddRenewal CanBookBeRenewed LostItem AddIssue AddReturn ); >+use C4::Circulation qw( AddRenewal CanBookBeRenewed LostItem AddIssue AddReturn MarkIssueReturned ); > use Koha::Account; > use Koha::Account::Lines; > use Koha::Account::Offsets; >@@ -448,9 +448,9 @@ subtest 'apply() tests' => sub { > $schema->storage->txn_rollback; > }; > >-subtest 'Keep account info when related patron, staff, item or cash_register is deleted' => sub { >+subtest 'Keep account info when related patron, staff, item, issue or cash_register is deleted' => sub { > >- plan tests => 4; >+ plan tests => 7; > > $schema->storage->txn_begin; > >@@ -460,24 +460,36 @@ subtest 'Keep account info when related patron, staff, item or cash_register is > my $issue = $builder->build_object( > { > class => 'Koha::Checkouts', >- value => { itemnumber => $item->itemnumber } >+ value => { itemnumber => $item->itemnumber, borrowernumber => $patron->borrowernumber } > } > ); > my $register = $builder->build_object({ class => 'Koha::Cash::Registers' }); > > my $line = Koha::Account::Line->new( >- { >- borrowernumber => $patron->borrowernumber, >- manager_id => $staff->borrowernumber, >- itemnumber => $item->itemnumber, >- debit_type_code => "OVERDUE", >- status => "RETURNED", >- amount => 10, >- interface => 'commandline', >- register_id => $register->id >- })->store; >+ { >+ borrowernumber => $patron->borrowernumber, >+ manager_id => $staff->borrowernumber, >+ itemnumber => $item->itemnumber, >+ debit_type_code => "OVERDUE", >+ issue_id => $issue->id, >+ old_issue_id => undef, >+ status => "RETURNED", >+ amount => 10, >+ interface => 'commandline', >+ register_id => $register->id >+ } >+ )->store; >+ >+ MarkIssueReturned($patron->borrowernumber, $item->itemnumber, undef, 0 ); >+ $line = $line->get_from_storage; >+ is( $line->issue_id, undef, "The account line should not be deleted when the related issue is archived"); >+ is( $line->old_issue_id, $issue->id, "The account line link to the archived issue"); >+ >+ my $old_issue = Koha::Old::Checkouts->find($issue->id); >+ $old_issue->delete; >+ $line = $line->get_from_storage; >+ is( $line->old_issue_id, undef, "The account line should not be deleted when the related old_issue is delete"); > >- $issue->delete; > $item->delete; > $line = $line->get_from_storage; > is( $line->itemnumber, undef, "The account line should not be deleted when the related item is delete"); >-- >2.43.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 22421
:
85773
|
85774
|
85775
|
90352
|
90353
|
90354
|
90359
|
90360
|
90361
|
90362
|
90365
|
90366
|
90367
|
90368
|
161919
|
161920
|
161921
|
161922
|
161923
|
162244
|
162245
|
162246
|
162247
|
162248
|
166631
|
173287
|
173288
|
173289
|
173305
|
173790
|
173791
|
173792
|
173793
|
173794
|
173795
|
173796
|
173797
|
173798
|
173799
|
174281