Bugzilla – Attachment 168599 Details for
Bug 33284
checkout_renewals table retains checkout history in violation of patron privacy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33284: (follow-up) Fix unit tests
Bug-33284-follow-up-Fix-unit-tests.patch (text/plain), 3.32 KB, created by
Martin Renvoize (ashimema)
on 2024-07-08 16:20:57 UTC
(
hide
)
Description:
Bug 33284: (follow-up) Fix unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-07-08 16:20:57 UTC
Size:
3.32 KB
patch
obsolete
>From 9c24e3eff5390939e1f8542c281c5c37f0f9e894 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 8 Jul 2024 17:16:19 +0100 >Subject: [PATCH] Bug 33284: (follow-up) Fix unit tests > >We have a case here where we have checkout_id pointing at issues and >old_issues tables. We need to trick TestBuilder to NOT automagically >build our related checkout.. This patch passes 'undef' to the foreign >key field and then sets it after the fact to the related Old::Checkouts >objects we've already built above. > >This patch should prevent the random failures we were seeing before >--- > t/db_dependent/Koha/Checkout.t | 16 +++++++--------- > t/db_dependent/Koha/Old/Checkouts.t | 6 ++++-- > 2 files changed, 11 insertions(+), 11 deletions(-) > >diff --git a/t/db_dependent/Koha/Checkout.t b/t/db_dependent/Koha/Checkout.t >index 7459cbcbf8a..1b4eb1eb428 100755 >--- a/t/db_dependent/Koha/Checkout.t >+++ b/t/db_dependent/Koha/Checkout.t >@@ -54,26 +54,24 @@ subtest 'renewals() tests' => sub { > plan tests => 2; > $schema->storage->txn_begin; > >- my $checkout = $builder->build_object( >- { >- class => 'Koha::Checkouts' >- } >- ); >+ my $checkout = $builder->build_object( { class => 'Koha::Checkouts' } ); > my $renewal1 = $builder->build_object( > { > class => 'Koha::Checkouts::Renewals', >- value => { checkout_id => $checkout->issue_id } >+ value => { checkout_id => undef } > } > ); >+ $renewal1->checkout_id( $checkout->issue_id )->store(); > my $renewal2 = $builder->build_object( > { > class => 'Koha::Checkouts::Renewals', >- value => { checkout_id => $checkout->issue_id } >+ value => { checkout_id => undef } > } > ); >+ $renewal2->checkout_id( $checkout->issue_id )->store(); > >- is( ref($checkout->renewals), 'Koha::Checkouts::Renewals', 'Object set type is correct' ); >- is( $checkout->renewals->count, 2, "Count of renewals is correct" ); >+ is( ref( $checkout->renewals ), 'Koha::Checkouts::Renewals', 'Object set type is correct' ); >+ is( $checkout->renewals->count, 2, "Count of renewals is correct" ); > > $schema->storage->txn_rollback; > }; >diff --git a/t/db_dependent/Koha/Old/Checkouts.t b/t/db_dependent/Koha/Old/Checkouts.t >index 233ccc39631..e3b65183c9e 100755 >--- a/t/db_dependent/Koha/Old/Checkouts.t >+++ b/t/db_dependent/Koha/Old/Checkouts.t >@@ -93,21 +93,23 @@ subtest 'anonymize() tests' => sub { > { > class => 'Koha::Checkouts::Renewals', > value => { >- checkout_id => $checkout_4->id, >+ checkout_id => undef, > interface => 'opac', > renewer_id => $patron->id > } > } > ); >+ $renewal_1->checkout_id( $checkout_4->id )->store(); > my $renewal_2 = $builder->build_object( > { > class => 'Koha::Checkouts::Renewals', > value => { >- checkout_id => $checkout_4->id, >+ checkout_id => undef, > interface => 'intranet' > } > } > ); >+ $renewal_2->checkout_id( $checkout_4->id )->store(); > > is( $patron->old_checkouts->count, 4, 'Patron has 4 completed checkouts' ); > is( $checkout_4->renewals->count, 2, 'Checkout 4 has 2 renewals' ); >-- >2.45.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 33284
:
148469
|
148486
|
148487
|
148670
|
148671
|
148672
|
148772
|
148773
|
148774
|
168596
|
168597
|
168598
| 168599