Bugzilla – Attachment 123503 Details for
Bug 27946
Add a charge per article request to patron categories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27946: Add tests
Bug-27946-Add-tests.patch (text/plain), 3.66 KB, created by
Agustín Moyano
on 2021-08-05 15:35:27 UTC
(
hide
)
Description:
Bug 27946: Add tests
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2021-08-05 15:35:27 UTC
Size:
3.66 KB
patch
obsolete
>From 6e26423a99ac9a2531dff27b7272cda80e767b18 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 23 Apr 2021 23:17:39 +0000 >Subject: [PATCH] Bug 27946: Add tests > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/ArticleRequests.t | 79 +++++++++++++++++++++++++++++++- > t/lib/TestBuilder.pm | 1 + > 2 files changed, 79 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/ArticleRequests.t b/t/db_dependent/ArticleRequests.t >index 3f0ec37cd3..f27ef8bf48 100755 >--- a/t/db_dependent/ArticleRequests.t >+++ b/t/db_dependent/ArticleRequests.t >@@ -19,7 +19,7 @@ use Modern::Perl; > > use POSIX qw(strftime); > >-use Test::More tests => 54; >+use Test::More tests => 55; > > use t::lib::TestBuilder; > use t::lib::Mocks; >@@ -252,4 +252,81 @@ subtest 'may_article_request' => sub { > $cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY ); > }; > >+subtest 'article request fee' => sub { >+ plan tests => 10; >+ >+ t::lib::Mocks::mock_preference('ArticleRequests', 1); >+ >+ my $item = $builder->build_sample_item; >+ >+ my $category = $builder->build_object( >+ { >+ class => 'Koha::Patron::Categories', >+ value => { >+ article_request_fee => undef >+ } >+ } >+ ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ categorycode => $category->categorycode >+ }, >+ } >+ ); >+ $patron->account->lines->delete(); >+ >+ my $article_request_1 = Koha::ArticleRequest->new( >+ { >+ borrowernumber => $patron->id, >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->itemnumber, >+ title => 'an article request', >+ } >+ )->store(); >+ >+ is($patron->account->balance, 0, 'There are no account lines'); >+ is($patron->article_requests_current->count, 1, 'There is one current article request'); >+ >+ $category->article_request_fee(10)->store(); >+ >+ my $article_request_2 = Koha::ArticleRequest->new( >+ { >+ borrowernumber => $patron->id, >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->itemnumber, >+ title => 'an second article request', >+ } >+ )->store(); >+ >+ is($patron->account->balance, 10, 'Patron owes 10'); >+ is($patron->article_requests_current->count, 2, 'There are 2 current article requests'); >+ >+ $category->article_request_fee(20)->store(); >+ >+ my $article_request_3 = Koha::ArticleRequest->new( >+ { >+ borrowernumber => $patron->id, >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->itemnumber, >+ title => 'an third article request', >+ } >+ )->store(); >+ >+ is($patron->account->balance, 30, 'Patron owes 30'); >+ is($patron->article_requests_current->count, 3, 'There are 3 current article requests'); >+ >+ $article_request_2->cancel(); >+ >+ is($patron->account->balance, 20, 'Patron owes 20'); >+ is($patron->article_requests_current->count, 2, 'There are 2 current article requests'); >+ >+ $article_request_3->cancel(); >+ >+ is($patron->account->balance, 0, 'There are no account lines'); >+ is($patron->article_requests_current->count, 1, 'There is one current article request'); >+ >+}; >+ > $schema->storage->txn_rollback(); >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index e8b0dbf126..27ce564009 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -570,6 +570,7 @@ sub _gen_default_values { > category_type => sub { return [ qw( A C S I P ) ]->[int(rand(5))] }, > min_password_length => undef, > require_strong_password => undef, >+ article_request_fee => undef, > }, > Branch => { > pickup_location => 0, >-- >2.25.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 27946
:
120144
|
120145
|
120146
|
120147
|
122522
|
122529
|
122530
|
122531
|
122532
|
122552
|
123503
|
123504
|
123505
|
123506
|
123507
|
128660
|
128661
|
128662
|
128663
|
128664
|
128665
|
128868
|
128869
|
128870
|
128871
|
128872
|
128873
|
129141
|
129142
|
129143
|
129144
|
129145
|
129146
|
129147
|
129171
|
129172
|
129173
|
129174
|
129175
|
129176
|
129177