Bugzilla – Attachment 53658 Details for
Bug 16966
Koha::Patrons - Move GetBorrowersWithIssuesHistoryOlderThan to search_patrons_to_anonymise
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16966: GetBorrowersWithIssuesHistoryOlderThan - Highlight the existing issue in tests
Bug-16966-GetBorrowersWithIssuesHistoryOlderThan--.patch (text/plain), 3.74 KB, created by
Jonathan Druart
on 2016-07-22 17:06:15 UTC
(
hide
)
Description:
Bug 16966: GetBorrowersWithIssuesHistoryOlderThan - Highlight the existing issue in tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-07-22 17:06:15 UTC
Size:
3.74 KB
patch
obsolete
>From 2a13cb19a37e88ec123a027bbeecdafba1bf853f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 22 Jul 2016 15:57:26 +0100 >Subject: [PATCH] Bug 16966: GetBorrowersWithIssuesHistoryOlderThan - Highlight > the existing issue in tests > >If IndependentBranches is set, the code is buggy. This patch only >highlight the bug by providing a test. >--- > t/db_dependent/Circulation/AnonymiseIssueHistory.t | 42 +++++++++++++++++++--- > 1 file changed, 38 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Circulation/AnonymiseIssueHistory.t b/t/db_dependent/Circulation/AnonymiseIssueHistory.t >index a171897..e013abc 100644 >--- a/t/db_dependent/Circulation/AnonymiseIssueHistory.t >+++ b/t/db_dependent/Circulation/AnonymiseIssueHistory.t >@@ -18,7 +18,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 5; > > use C4::Context; > use C4::Circulation; >@@ -56,9 +56,10 @@ t::lib::Mocks::mock_preference( 'AnonymousPatron', $anonymous->{borrowernumber} > > subtest 'patron privacy is 1 (default)' => sub { > plan tests => 4; >+ t::lib::Mocks::mock_preference('IndependentBranches', 0); > my $patron = $builder->build( > { source => 'Borrower', >- value => { privacy => 1, } >+ value => { privacy => 1, branchcode => $userenv_patron->{branchcode} } > } > ); > my $item = $builder->build( >@@ -94,10 +95,11 @@ subtest 'patron privacy is 1 (default)' => sub { > > subtest 'patron privacy is 0 (forever)' => sub { > plan tests => 3; >+ t::lib::Mocks::mock_preference('IndependentBranches', 0); > > my $patron = $builder->build( > { source => 'Borrower', >- value => { privacy => 0, } >+ value => { privacy => 0, branchcode => $userenv_patron->{branchcode} } > } > ); > my $item = $builder->build( >@@ -133,9 +135,10 @@ t::lib::Mocks::mock_preference( 'AnonymousPatron', '' ); > > subtest 'AnonymousPatron is not defined' => sub { > plan tests => 4; >+ t::lib::Mocks::mock_preference('IndependentBranches', 0); > my $patron = $builder->build( > { source => 'Borrower', >- value => { privacy => 1, } >+ value => { privacy => 1, branchcode => $userenv_patron->{branchcode} } > } > ); > my $item = $builder->build( >@@ -168,6 +171,37 @@ subtest 'AnonymousPatron is not defined' => sub { > is( $borrowernumber_used_to_anonymised, undef, 'With AnonymousPatron is not defined, the issue should have been anonymised anyway' ); > }; > >+subtest 'Logged in librarian is not superlibrarian & IndependentBranches' => sub { >+ plan tests => 1; >+ t::lib::Mocks::mock_preference('IndependentBranches', 1); >+ my $patron = $builder->build( >+ { source => 'Borrower', >+ value => { privacy => 1 } # Another branchcode than the logged in librarian >+ } >+ ); >+ my $item = $builder->build( >+ { source => 'Item', >+ value => { >+ itemlost => 0, >+ withdrawn => 0, >+ }, >+ } >+ ); >+ my $issue = $builder->build( >+ { source => 'Issue', >+ value => { >+ borrowernumber => $patron->{borrowernumber}, >+ itemnumber => $item->{itemnumber}, >+ }, >+ } >+ ); >+ >+ my ( $returned, undef, undef ) = C4::Circulation::AddReturn( $item->{barcode}, undef, undef, undef, '2010-10-10' ); >+ my $patrons_to_anonymise = C4::Members::GetBorrowersWithIssuesHistoryOlderThan( '2010-10-11' ); >+ my ( $rows_affected, $err ) = C4::Circulation::AnonymiseIssueHistory('2010-10-11'); >+ is( scalar(@$patrons_to_anonymise), $rows_affected, , 'AnonymiseIssueHistory should affect at least 1 row' ); >+}; >+ > subtest 'Test StoreLastBorrower' => sub { > plan tests => 6; > >-- >2.8.1
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 16966
:
53658
|
53659
|
53660
|
53661
|
56376
|
56377
|
56378
|
56379
|
56639
|
56640
|
56641
|
56642
|
57170
|
57171
|
57172
|
57885
|
57886
|
57887
|
57924
|
57925
|
57926
|
58282
|
58283
|
58284
|
58285
|
58286
|
60377
|
60378
|
60379
|
60380
|
60381
|
60382
|
60648
|
60649
|
60650
|
60651
|
60652
|
60653
|
60701
|
60702
|
60703
|
60704
|
60705
|
60706
|
60707
|
60708
|
60709