From: Tomas Cohen Arazi Date: Fri, 12 Apr 2019 13:42:30 +0000 (-0300) Subject: Bug 22694: Unit tests X-Git-Url: http://git.equinoxoli.org/?p=koha-equinox.git;a=commitdiff_plain;h=e3b68414373ee23418a6dc3ce10e859ae8fb66b8 Bug 22694: Unit tests Signed-off-by: Bin Wen Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens --- diff --git a/t/db_dependent/Koha/Patron/Category.t b/t/db_dependent/Koha/Patron/Category.t index 06fe7ec..7f8e779 100644 --- a/t/db_dependent/Koha/Patron/Category.t +++ b/t/db_dependent/Koha/Patron/Category.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 2; +use Test::More tests => 3; use t::lib::TestBuilder; use t::lib::Mocks; @@ -144,3 +144,25 @@ subtest 'effective_change_password() tests' => sub { $schema->storage->txn_rollback; }; }; + +subtest 'override_hidden_items() tests' => sub { + + plan tests => 4; + + $schema->storage->txn_begin; + + my $category_1 = $builder->build_object({ class => 'Koha::Patron::Categories' }); + my $category_2 = $builder->build_object({ class => 'Koha::Patron::Categories' }); + + t::lib::Mocks::mock_preference( 'OpacHiddenItemsExceptions', $category_1->categorycode . '|' . $category_2->categorycode . '|RANDOM' ); + + ok( $category_1->override_hidden_items, 'Category configured to override' ); + ok( $category_2->override_hidden_items, 'Category configured to override' ); + + t::lib::Mocks::mock_preference( 'OpacHiddenItemsExceptions', 'RANDOM|' . $category_2->categorycode ); + + ok( !$category_1->override_hidden_items, 'Category not configured to override' ); + ok( $category_2->override_hidden_items, 'Category configured to override' ); + + $schema->storage->txn_rollback; +};