[Koha-bugs] [Bug 33285] It should be possible to specify the separator used in runreport.pl
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Mar 27 15:36:36 CEST 2023
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33285
Andrew Fuerste-Henry <andrewfh at dubcolib.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #148769|0 |1
is obsolete| |
--- Comment #6 from Andrew Fuerste-Henry <andrewfh at dubcolib.org> ---
Comment on attachment 148769
--> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=148769
Bug 33284: Unit test
>From 7885567b7214e27baeef1e951456b6c78833ecb4 Mon Sep 17 00:00:00 2001
>From: Martin Renvoize <martin.renvoize at ptfs-europe.com>
>Date: Tue, 21 Mar 2023 15:01:08 +0000
>Subject: [PATCH] Bug 33284: Unit test
>
>Signed-off-by: Andrew Fuerste-Henry <andrewfh at dubcolib.org>
>
>https://bugs.koha-community.org/show_bug.cgi?id=33285
>---
> t/db_dependent/Koha/Old/Checkout.t | 37 ++++++++++++++++++++++++-----
> t/db_dependent/Koha/Old/Checkouts.t | 30 ++++++++++++++++++++++-
> 2 files changed, 60 insertions(+), 7 deletions(-)
>
>diff --git a/t/db_dependent/Koha/Old/Checkout.t b/t/db_dependent/Koha/Old/Checkout.t
>index 7cf520e96f..ade2a1ff2b 100755
>--- a/t/db_dependent/Koha/Old/Checkout.t
>+++ b/t/db_dependent/Koha/Old/Checkout.t
>@@ -30,7 +30,7 @@ my $builder = t::lib::TestBuilder->new;
>
> subtest 'anonymize() tests' => sub {
>
>- plan tests => 8;
>+ plan tests => 9;
>
> $schema->storage->txn_begin;
>
>@@ -50,6 +50,25 @@ subtest 'anonymize() tests' => sub {
> value => { borrowernumber => $patron->id }
> }
> );
>+ my $renewal_1 = $builder->build_object(
>+ {
>+ class => 'Koha::Checkouts::Renewals',
>+ value => {
>+ checkout_id => $checkout_2->id,
>+ interface => 'opac',
>+ renewer_id => $patron->id
>+ }
>+ }
>+ );
>+ my $renewal_2 = $builder->build_object(
>+ {
>+ class => 'Koha::Checkouts::Renewals',
>+ value => {
>+ checkout_id => $checkout_2->id,
>+ interface => 'intranet'
>+ }
>+ }
>+ );
>
> is( $patron->old_checkouts->count, 2, 'Patron has 2 completed checkouts' );
>
>@@ -63,20 +82,26 @@ subtest 'anonymize() tests' => sub {
> is( $@->syspref, 'AnonymousPatron', 'syspref parameter is correctly passed' );
> is( $patron->old_checkouts->count, 2, 'No changes, patron has 2 linked completed checkouts' );
>
>- is( $checkout_1->borrowernumber, $patron->id,
>- 'Anonymized hold not linked to patron' );
> is( $checkout_2->borrowernumber, $patron->id,
>- 'Not anonymized hold still linked to patron' );
>+ 'Checkout to anonymize still linked to patron' );
>+ is( $checkout_2->renewals->count, 2, 'Checkout 2 has 2 renewals' );
>
> my $anonymous_patron =
> $builder->build_object( { class => 'Koha::Patrons' } );
> t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous_patron->id );
>
>- # anonymize second hold
>+ # anonymize second checkout
> $checkout_2->anonymize;
> $checkout_2->discard_changes;
> is( $checkout_2->borrowernumber, $anonymous_patron->id,
>- 'Anonymized hold linked to anonymouspatron' );
>+ 'Anonymized checkout linked to anonymouspatron' );
>+ is(
>+ $checkout_2->renewals->search(
>+ { renewer_id => $anonymous_patron->id }
>+ )->count,
>+ 1,
>+ 'OPAC renewal was anonymized'
>+ );
>
> $schema->storage->txn_rollback;
> };
>diff --git a/t/db_dependent/Koha/Old/Checkouts.t b/t/db_dependent/Koha/Old/Checkouts.t
>index 2c7c52ad62..7254bcba8e 100755
>--- a/t/db_dependent/Koha/Old/Checkouts.t
>+++ b/t/db_dependent/Koha/Old/Checkouts.t
>@@ -32,7 +32,7 @@ my $builder = t::lib::TestBuilder->new;
>
> subtest 'anonymize() tests' => sub {
>
>- plan tests => 10;
>+ plan tests => 13;
>
> $schema->storage->txn_begin;
>
>@@ -89,8 +89,28 @@ subtest 'anonymize() tests' => sub {
> }
> }
> );
>+ my $renewal_1 = $builder->build_object(
>+ {
>+ class => 'Koha::Checkouts::Renewals',
>+ value => {
>+ checkout_id => $checkout_4->id,
>+ interface => 'opac',
>+ renewer_id => $patron->id
>+ }
>+ }
>+ );
>+ my $renewal_2 = $builder->build_object(
>+ {
>+ class => 'Koha::Checkouts::Renewals',
>+ value => {
>+ checkout_id => $checkout_4->id,
>+ interface => 'intranet'
>+ }
>+ }
>+ );
>
> is( $patron->old_checkouts->count, 4, 'Patron has 4 completed checkouts' );
>+ is( $checkout_4->renewals->count, 2, 'Checkout 4 has 2 renewals' );
>
> # filter them so only the older two are part of the resultset
> my $checkouts = $patron->old_checkouts->filter_by_last_update(
>@@ -112,6 +132,14 @@ subtest 'anonymize() tests' => sub {
> is( $anonymized_count, 2, 'update() tells 2 rows were updated' );
>
> is( $patron->old_checkouts->count, 2, 'Patron has 2 completed checkouts' );
>+ is( $checkout_4->renewals->count, 2, 'Checkout 4 still has 2 renewals' );
>+ is(
>+ $checkout_4->renewals->search(
>+ { renewer_id => $anonymous_patron->id }
>+ )->count,
>+ 1,
>+ 'OPAC renewal was anonymized'
>+ );
>
> $schema->storage->txn_rollback;
> };
>--
>2.30.2
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list