Bugzilla – Attachment 140171 Details for
Bug 31333
Add the ability to limit purchase suggestions by patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31333: Unit tests
Bug-31333-Unit-tests.patch (text/plain), 2.98 KB, created by
Owen Leonard
on 2022-09-02 17:36:57 UTC
(
hide
)
Description:
Bug 31333: Unit tests
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2022-09-02 17:36:57 UTC
Size:
2.98 KB
patch
obsolete
>From 6bf528bd907bf27ad0b943b117ec53eac9b9e7e4 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 15 Aug 2022 06:39:23 +0000 >Subject: [PATCH] Bug 31333: Unit tests > >Test plan: >1. Run tests (Categories.t has been updated by me, and I suggest running >Suggestions.t to confirm it still passes): > >sudo koha-shell kohadev >prove t/db_dependent/Koha/Patron/Categories.t >prove t/db_dependent/Koha/Suggestions.t > >Sponsored-by: Catalyst IT, New Zealand > >Signed-off-by: Rhonda Kuiper <rkuiper@roundrocktexas.gov> > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > t/db_dependent/Koha/Patron/Categories.t | 27 ++++++++++++++++++++++++- > 1 file changed, 26 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Patron/Categories.t b/t/db_dependent/Koha/Patron/Categories.t >index f6cdba7e24..6be30bb82a 100755 >--- a/t/db_dependent/Koha/Patron/Categories.t >+++ b/t/db_dependent/Koha/Patron/Categories.t >@@ -19,7 +19,7 @@ > > use Modern::Perl; > >-use Test::More tests => 10; >+use Test::More tests => 11; > > use C4::Context; > use Koha::Database; >@@ -115,5 +115,30 @@ my $new_category_4 = Koha::Patron::Category->new( > )->store; > is( Koha::Patron::Categories->search->count, $nb_of_categories + 2, 'upperagelimit and dateofbirthrequired should have a default value if empty string is passed' ); > >+subtest 'can_make_suggestions' => sub { >+ plan tests => 5; >+ t::lib::Mocks::mock_preference('suggestion', 0); >+ my $category = Koha::Patron::Category->new({ >+ categorycode => 'the_cat', >+ category_type => 'A', >+ description => 'thecatdesc', >+ enrolementperiod => undef >+ })->store; >+ is ( $category->can_make_suggestions, undef, 'With suggestion syspref disabled and suggestionPatronCategoryExceptions syspref empty then Koha::Patron::Category->can_make_suggestions() returns undef' ); >+ >+ t::lib::Mocks::mock_preference('suggestion', 1); >+ is( $category->can_make_suggestions, 1, 'With suggestion syspref enabled and suggestionPatronsCategoryExceptions syspref empty then Koha::Patron::Category->can_make_suggestions() returns 1' ); >+ >+ t::lib::Mocks::mock_preference('suggestionPatronCategoryExceptions', 'the_cat'); >+ is( $category->can_make_suggestions, undef, 'With suggestion syspref enabled and suggestionPatronCategoryExceptions syspref = "the_cat" then Koha::Patron::Category->can_make_suggestions() returns undef' ); >+ >+ t::lib::Mocks::mock_preference('suggestionPatronCategoryExceptions', 'mycatcodeW'); >+ is( $category->can_make_suggestions, 1, 'With suggestion syspref enabled and suggestionPatronCategoryExceptions syspref = "mycatcodeW" then Koha::Patron::Category->can_make_suggestions returns 1' ); >+ >+ t::lib::Mocks::mock_preference('suggestion', 0); >+ is( $category->can_make_suggestions, undef, 'With suggestion syspref disabled and suggestionPatronCategoryExceptions syspref = "mycatcodeW" then Koha::Patron::Category->can_make_suggestions returns undef' ); >+ $category->delete; >+}; >+ > $schema->storage->txn_rollback; > >-- >2.20.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 31333
:
139112
|
139113
|
139114
|
139165
|
139897
|
139898
|
139935
|
139936
|
140169
|
140170
|
140171
|
140172
|
140173
|
140174
|
140270
|
140271
|
140272
|
140273
|
140274
|
140275
|
140276
|
141392
|
141393