Bugzilla – Attachment 142707 Details for
Bug 31421
Library limitation on patron category breaks patron search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31421: Add tests
Bug-31421-Add-tests.patch (text/plain), 2.60 KB, created by
Jonathan Druart
on 2022-10-27 10:41:36 UTC
(
hide
)
Description:
Bug 31421: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-10-27 10:41:36 UTC
Size:
2.60 KB
patch
obsolete
>From b38061442286077a8cc0e50271d8b6d2ea279514 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 27 Oct 2022 12:39:20 +0200 >Subject: [PATCH] Bug 31421: Add tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Template/Plugin/Categories.t | 22 +++++++++++++++------ > 1 file changed, 16 insertions(+), 6 deletions(-) > >diff --git a/t/db_dependent/Template/Plugin/Categories.t b/t/db_dependent/Template/Plugin/Categories.t >index e4579846df5..c409ccf57fb 100755 >--- a/t/db_dependent/Template/Plugin/Categories.t >+++ b/t/db_dependent/Template/Plugin/Categories.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 4; >+use Test::More tests => 6; > use t::lib::Mocks; > use t::lib::TestBuilder; > >@@ -31,25 +31,35 @@ my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; > > my $builder = t::lib::TestBuilder->new; >- > my $nb_categories = Koha::Patron::Categories->count; > > # Create sample categories >-my $category_1 = $builder->build( { source => 'Category' } ); >+my $category_1 = $builder->build_object( { class => 'Koha::Patron::Categories' } ); > my @categories = Koha::Template::Plugin::Categories->new->all->as_list; > is( scalar(@categories), 1 + $nb_categories, '->all returns all defined categories' ); > >-my $category_2 = $builder->build( { source => 'Category' } ); >+my $category_2 = $builder->build_object( { class => 'Koha::Patron::Categories' } ); > @categories = Koha::Template::Plugin::Categories->new->all->as_list; > is( scalar(@categories), 2 + $nb_categories, '->all returns all defined categories' ); > > is( Koha::Template::Plugin::Categories->GetName( >- $category_1->{categorycode} >+ $category_1->categorycode > ), >- $category_1->{description}, >+ $category_1->description, > '->GetName returns the right description' > ); > >+my $library_1 = $builder->build_object( { class => 'Koha::Libraries' } ); >+my $library_2 = $builder->build_object( { class => 'Koha::Libraries' } ); >+$category_1->library_limits( [ $library_1->branchcode ] ); >+$category_2->library_limits( [ $library_2->branchcode ] ); >+t::lib::Mocks::mock_userenv( { branchcode => $library_1->branchcode } ); >+my $limited = Koha::Template::Plugin::Categories->limited; >+is( $limited->search( { 'me.categorycode' => $category_1->categorycode } )->count, >+ 1, 'Category 1 is available from library 1' ); >+is( $limited->search( { 'me.categorycode' => $category_2->categorycode } )->count, >+ 0, 'Category 2 is not available from library 1' ); >+ > $schema->storage->txn_rollback; > > subtest 'can_any_reset_password() tests' => sub { >-- >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 31421
:
141468
|
141479
|
142247
|
142332
|
142705
|
142706
| 142707