Bugzilla – Attachment 123711 Details for
Bug 27944
Add new stages to the article request process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27944: (QA follow-up) Rename ->open for ->set_pending
Bug-27944-QA-follow-up-Rename--open-for--setpendin.patch (text/plain), 4.86 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-08-10 16:44:15 UTC
(
hide
)
Description:
Bug 27944: (QA follow-up) Rename ->open for ->set_pending
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-08-10 16:44:15 UTC
Size:
4.86 KB
patch
obsolete
>From 780ead447bd0ea6131a9c27b47684dd934217177 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 10 Aug 2021 13:16:53 -0300 >Subject: [PATCH] Bug 27944: (QA follow-up) Rename ->open for ->set_pending > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/ArticleRequest.pm | 8 +++-- > .../prog/en/modules/circ/article-requests.tt | 2 +- > svc/article_request | 4 +-- > t/db_dependent/ArticleRequests.t | 35 +++++++++++++++---- > 4 files changed, 36 insertions(+), 13 deletions(-) > >diff --git a/Koha/ArticleRequest.pm b/Koha/ArticleRequest.pm >index 973d7a161a..71a106d3f7 100644 >--- a/Koha/ArticleRequest.pm >+++ b/Koha/ArticleRequest.pm >@@ -36,7 +36,7 @@ Koha::ArticleRequest - Koha Article Request Object class > > =head1 API > >-=head2 Class Methods >+=head2 Class methods > > =cut > >@@ -53,11 +53,11 @@ sub request { > return $self; > } > >-=head3 open >+=head3 set_pending > > =cut > >-sub open { >+sub set_pending { > my ($self) = @_; > > $self->status(Koha::ArticleRequest::Status::Pending); >@@ -216,6 +216,8 @@ sub store { > } > } > >+=head2 Internal methods >+ > =head3 _type > > =cut >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >index fabf326dd2..afb4d841f5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/article-requests.tt >@@ -606,7 +606,7 @@ > type: "POST", > url: '/cgi-bin/koha/svc/article_request', > data: { >- action: 'open', >+ action: 'pending', > id: id, > }, > success: function( data ) { >diff --git a/svc/article_request b/svc/article_request >index a372cd6199..3b5105ad0d 100755 >--- a/svc/article_request >+++ b/svc/article_request >@@ -50,8 +50,8 @@ if ($ar) { > elsif ( $action eq 'process' ) { > $ar = $ar->process(); > } >- elsif ( $action eq 'open' ) { >- $ar = $ar->open(); >+ elsif ( $action eq 'pending' ) { >+ $ar = $ar->set_pending(); > } > elsif ( $action eq 'complete' ) { > $ar = $ar->complete(); >diff --git a/t/db_dependent/ArticleRequests.t b/t/db_dependent/ArticleRequests.t >index bb4b5f8b8d..c647745540 100755 >--- a/t/db_dependent/ArticleRequests.t >+++ b/t/db_dependent/ArticleRequests.t >@@ -19,7 +19,8 @@ use Modern::Perl; > > use POSIX qw(strftime); > >-use Test::More tests => 54; >+use Test::More tests => 55; >+use Test::MockModule; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -101,8 +102,7 @@ is( $article_request->status, Koha::ArticleRequest::Status::Completed, '$ar->com > # cancel > $article_request->cancel(); > is( $article_request->status, Koha::ArticleRequest::Status::Canceled, '$ar->complete() changes status to Canceled' ); >-$article_request->status(Koha::ArticleRequest::Status::Pending); >-$article_request->store(); >+$article_request->set_pending(); > > is( $article_request->biblio->id, $biblio->id, '$ar->biblio() gets corresponding Koha::Biblio object' ); > is( $article_request->item->id, $item->id, '$ar->item() gets corresponding Koha::Item object' ); >@@ -120,8 +120,7 @@ is( $patron->article_requests_current()->count(), 0, 'Completed request not retu > $article_request->cancel(); > is( $patron->article_requests_current()->count(), 0, 'Canceled request not returned for article_requests_current' ); > >-$article_request->status(Koha::ArticleRequest::Status::Pending); >-$article_request->store(); >+$article_request->set_pending(); > > is( $patron->article_requests_finished()->count(), 0, 'Open request returned for article_requests_finished' ); > $article_request->process(); >@@ -130,8 +129,7 @@ $article_request->complete(); > $article_request->cancel(); > is( $patron->article_requests_finished()->count(), 1, 'Canceled request not returned for article_requests_finished' ); > >-$article_request->status(Koha::ArticleRequest::Status::Pending); >-$article_request->store(); >+$article_request->set_pending(); > > $ar = $biblio->article_requests(); > is( ref($ar), 'Koha::ArticleRequests', '$biblio->article_requests returns Koha::ArticleRequests object' ); >@@ -253,3 +251,26 @@ subtest 'may_article_request' => sub { > }; > > $schema->storage->txn_rollback(); >+ >+subtest 'set_pending() tests' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ my $ar_mock = Test::MockModule->new('Koha::ArticleRequest'); >+ $ar_mock->mock( 'notify', sub { ok( 1, '->notify() called' ); } ); >+ >+ my $ar = $builder->build_object( >+ { >+ class => 'Koha::ArticleRequests', >+ value => { status => Koha::ArticleRequest::Status::Requested } >+ } >+ ); >+ >+ $ar->set_pending()->discard_changes; >+ >+ is( $ar->status, Koha::ArticleRequest::Status::Pending ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >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 27944
:
119020
|
119021
|
119022
|
120454
|
122673
|
122836
|
122837
|
122838
|
122839
|
122842
|
122843
|
122857
|
122984
|
122985
|
122986
|
122987
|
122988
|
122989
|
122990
|
123710
|
123711
|
123712
|
123943
|
123944
|
123945
|
123946
|
123947
|
123948
|
123949
|
123950
|
123951
|
123952
|
124966
|
124967
|
124968
|
124969
|
124970
|
124971
|
124972
|
124973
|
124974
|
124975
|
124976
|
125158
|
125544
|
125565
|
125567
|
125762
|
125813