Bugzilla – Attachment 148892 Details for
Bug 32127
Sort patron categories by description in templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32127: Add unit test
Bug-32127-Add-unit-test.patch (text/plain), 2.14 KB, created by
Fridolin Somers
on 2023-03-29 08:54:12 UTC
(
hide
)
Description:
Bug 32127: Add unit test
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2023-03-29 08:54:12 UTC
Size:
2.14 KB
patch
obsolete
>From 8a6dab79ea5361fa7a7beb60a1306ab65b687305 Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Tue, 28 Mar 2023 22:52:08 -1000 >Subject: [PATCH] Bug 32127: Add unit test > >Run prove t/db_dependent/Template/Plugin/Categories.t >--- > t/db_dependent/Template/Plugin/Categories.t | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Template/Plugin/Categories.t b/t/db_dependent/Template/Plugin/Categories.t >index c409ccf57f..04580d7912 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 => 6; >+use Test::More tests => 7; > use t::lib::Mocks; > use t::lib::TestBuilder; > >@@ -34,14 +34,27 @@ my $builder = t::lib::TestBuilder->new; > my $nb_categories = Koha::Patron::Categories->count; > > # Create sample categories >-my $category_1 = $builder->build_object( { class => 'Koha::Patron::Categories' } ); >+my $category_1 = $builder->build_object( { class => 'Koha::Patron::Categories', value => { description => 'ZZZZZZ' } } ); > 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_object( { class => 'Koha::Patron::Categories' } ); >+my $category_2 = $builder->build_object( { class => 'Koha::Patron::Categories', value => { description => 'AAAAAA' } } ); > @categories = Koha::Template::Plugin::Categories->new->all->as_list; > is( scalar(@categories), 2 + $nb_categories, '->all returns all defined categories' ); > >+my $category_1_pos = 0; >+my $category_2_pos = 0; >+for ( my $i = 0 ; $i < scalar(@categories) ; $i++ ) { >+ my $idescription = $categories[$i]->description // ''; >+ if ( $idescription eq $category_1->description ) { >+ $category_1_pos = $i; >+ } >+ if ( $idescription eq $category_2->description ) { >+ $category_2_pos = $i; >+ } >+} >+ok( $category_1_pos > $category_2_pos, 'Categories are sorted by description' ); >+ > is( Koha::Template::Plugin::Categories->GetName( > $category_1->categorycode > ), >-- >2.39.0
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 32127
:
143382
|
143391
|
143815
|
148890
|
148891
|
148892
|
149099
|
149100
|
149364
|
149365