Bugzilla – Attachment 181209 Details for
Bug 39652
Pseudonymized_borrower_attributes causes subsequent pseudonymized_transactions to not be added
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39652: Add tests
Bug-39652-Add-tests.patch (text/plain), 2.82 KB, created by
David Nind
on 2025-04-19 09:27:50 UTC
(
hide
)
Description:
Bug 39652: Add tests
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-04-19 09:27:50 UTC
Size:
2.82 KB
patch
obsolete
>From 46deb790dc54276445eb582dc9ae3ac0d3c6a7db Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 16 Apr 2025 11:00:49 +0000 >Subject: [PATCH] Bug 39652: Add tests > >These tests prove the bug: >perl t/db_dependent/Koha/Pseudonymization.t > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Koha/Pseudonymization.t | 43 ++++++++++++++++++++++++-- > 1 file changed, 41 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha/Pseudonymization.t b/t/db_dependent/Koha/Pseudonymization.t >index de0a103946..36cfd57355 100755 >--- a/t/db_dependent/Koha/Pseudonymization.t >+++ b/t/db_dependent/Koha/Pseudonymization.t >@@ -79,7 +79,7 @@ subtest 'Config does not exist' => sub { > > subtest 'Koha::Anonymized::Transactions tests' => sub { > >- plan tests => 15; >+ plan tests => 16; > > $schema->storage->txn_begin; > >@@ -135,12 +135,20 @@ subtest 'Koha::Anonymized::Transactions tests' => sub { > is( $pseudonymized->itemcallnumber, $item->itemcallnumber, 'itemcallnumber copied correctly' ); > is( $pseudonymized->ccode, $item->ccode, 'ccode copied correctly' ); > >+ my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($statistic)->store; >+ >+ isnt( >+ $pseudonymized->id, >+ $next_p->id, >+ 'The id of the 2nd pseudonymized transaction should be different' >+ ); >+ > $schema->storage->txn_rollback; > }; > > subtest 'PseudonymizedBorrowerAttributes tests' => sub { > >- plan tests => 3; >+ plan tests => 5; > > $schema->storage->txn_begin; > >@@ -236,5 +244,36 @@ subtest 'PseudonymizedBorrowerAttributes tests' => sub { > 'Attribute 2 should be retrieved correctly' > ); > >+ my $number_of_attributes_before_2nd_p = $attributes->count; >+ >+ my $second_statistic = Koha::Statistic->new( >+ { >+ type => 'issue', >+ branch => $library->branchcode, >+ itemnumber => $item->itemnumber, >+ borrowernumber => $patron->borrowernumber, >+ itemtype => $item->effective_itemtype, >+ location => $item->location, >+ ccode => $item->ccode, >+ } >+ ); >+ >+ my $next_p = Koha::PseudonymizedTransaction->new_from_statistic($second_statistic)->store; >+ my $next_attributes = >+ Koha::Database->new->schema->resultset('PseudonymizedBorrowerAttribute') >+ ->search( { transaction_id => $next_p->id }, { order_by => 'attribute' } ); >+ >+ is( >+ $attributes->count, >+ $number_of_attributes_before_2nd_p, >+ 'The number of attributes for the original transaction should remain the same' >+ ); >+ >+ isnt( >+ $p->id, >+ $next_p->id, >+ 'The id of the 2nd pseudonymized transaction should be different' >+ ); >+ > $schema->storage->txn_rollback; > }; >-- >2.39.5
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 39652
:
181001
|
181002
|
181109
|
181110
|
181209
|
181210
|
181211
|
181382
|
181383
|
181384
|
181385