Bugzilla – Attachment 125150 Details for
Bug 27945
Limit the number of active article requests per patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27945: (follow-up) Fix tests for the adjusted check
Bug-27945-follow-up-Fix-tests-for-the-adjusted-che.patch (text/plain), 4.23 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-09-22 15:12:02 UTC
(
hide
)
Description:
Bug 27945: (follow-up) Fix tests for the adjusted check
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-09-22 15:12:02 UTC
Size:
4.23 KB
patch
obsolete
>From 78ee1c79388c22042b4de3cb21ca259578592428 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Tue, 7 Sep 2021 19:28:13 -0300 >Subject: [PATCH] Bug 27945: (follow-up) Fix tests for the adjusted check > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/ArticleRequests.t | 32 +++++++++++++++++++------------- > 1 file changed, 19 insertions(+), 13 deletions(-) > >diff --git a/t/db_dependent/ArticleRequests.t b/t/db_dependent/ArticleRequests.t >index 93aa5bdf11..49f9e3e5ed 100644 >--- a/t/db_dependent/ArticleRequests.t >+++ b/t/db_dependent/ArticleRequests.t >@@ -254,7 +254,7 @@ subtest 'may_article_request' => sub { > > > subtest 'article request limit' => sub { >- plan tests => 12; >+ plan tests => 13; > > t::lib::Mocks::mock_preference('ArticleRequests', 1); > >@@ -278,7 +278,7 @@ subtest 'article request limit' => sub { > ); > $patron->article_requests->delete(); > >- is($patron->can_request_article, 1, 'Patron can request more articles'); >+ is($patron->can_request_article, 1, 'There are no AR, so patron can request more articles'); > > my $article_request_1 = Koha::ArticleRequest->new( > { >@@ -289,7 +289,7 @@ subtest 'article request limit' => sub { > } > )->store(); > >- is($patron->can_request_article, 0, 'Patron cannot request more articles'); >+ is($patron->can_request_article, 0, 'Limit is 1, so patron cannot request more articles'); > is($patron->article_requests->count, 1, 'There is one current article request'); > > try { >@@ -298,38 +298,42 @@ subtest 'article request limit' => sub { > borrowernumber => $patron->id, > biblionumber => $item->biblionumber, > itemnumber => $item->itemnumber, >- title => 'an second article request', >+ title => 'a second article request', > } > )->store(); > } > catch { >- is(ref($_), 'Koha::Exceptions::ArticleRequest::LimitReached', 'Limit reached thrown'); >+ is(ref($_), 'Koha::Exceptions::ArticleRequest::LimitReached', 'When limit was reached and we ask for a new AR, Limit reached is thrown'); > }; > >- is($patron->can_request_article, 0, 'Patron cannot request more articles'); >+ is($patron->can_request_article, 0, 'There is still an AR, so patron cannot request more articles'); > is($patron->article_requests->count, 1, 'There is still one article request'); > >- $article_request_1->created_on(dt_from_string->add(days => -1))->store(); >+ $article_request_1->complete(); > >- is($patron->can_request_article, 1, 'Patron can request more articles'); >+ is($patron->can_request_article, 0, 'AR was completed but within one day, so patron cannot request more articles'); >+ >+ $article_request_1->updated_on(dt_from_string->add(days => -2))->store(); >+ >+ is($patron->can_request_article, 1, 'There are no completed AR within one day, so patron can request more articles'); > > my $article_request_3 = Koha::ArticleRequest->new( > { > borrowernumber => $patron->id, > biblionumber => $item->biblionumber, > itemnumber => $item->itemnumber, >- title => 'an third article request', >+ title => 'a third article request', > } > )->store(); > >- is($patron->can_request_article, 0, 'Patron cannot request more articles'); >+ is($patron->can_request_article, 0, 'A new AR was created, so patron cannot request more articles'); > is($patron->article_requests->count, 2, 'There are 2 article requests'); > > $article_request_3->cancel(); > >- is($patron->can_request_article, 1, 'Patron can request more articles'); >+ is($patron->can_request_article, 1, 'New AR was cancelled, so patron can request more articles'); > >- Koha::ArticleRequest->new( >+ my $article_request_4 = Koha::ArticleRequest->new( > { > borrowernumber => $patron->id, > biblionumber => $item->biblionumber, >@@ -338,7 +342,9 @@ subtest 'article request limit' => sub { > } > )->store(); > >- is($patron->can_request_article, 0, 'Patron cannot request more articles'); >+ $article_request_4->updated_on(dt_from_string->add(days => -30))->store(); >+ >+ is($patron->can_request_article, 0, 'There is an old AR but not completed or cancelled, so patron cannot request more articles'); > is($patron->article_requests->count, 3, 'There are 3 current article requests'); > > }; >-- >2.30.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 27945
:
123217
|
123218
|
123219
|
123220
|
123714
|
123715
|
123774
|
123775
|
123776
|
123777
|
123778
|
123820
|
124066
|
124067
|
124068
|
124069
|
124070
|
124071
|
124072
|
124073
|
124074
|
124075
|
124076
|
124077
|
124078
|
124079
|
124284
|
124285
|
124633
|
124673
|
124674
|
124675
|
124676
|
124677
|
124678
|
124679
|
124680
|
124681
|
124682
|
125140
|
125142
|
125143
|
125144
|
125145
|
125146
|
125147
|
125148
|
125149
|
125150
|
125151
|
125152
|
125178
|
125179
|
125569
|
125571
|
125638
|
125690
|
125702
|
125703
|
125704
|
125705
|
125706
|
125707
|
125726
|
125741
|
125761