Bugzilla – Attachment 57530 Details for
Bug 17640
t/db_dependent/Template/Plugin/Categories.t is failing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17640: Fix t/db_dependent/Template/Plugin/Categories.t
Bug-17640-Fix-tdbdependentTemplatePluginCategories.patch (text/plain), 2.39 KB, created by
Jonathan Druart
on 2016-11-16 09:45:09 UTC
(
hide
)
Description:
Bug 17640: Fix t/db_dependent/Template/Plugin/Categories.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-11-16 09:45:09 UTC
Size:
2.39 KB
patch
obsolete
>From 5ea7768a93f31bde2949832bc90153f044b665a0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 16 Nov 2016 09:41:26 +0000 >Subject: [PATCH] Bug 17640: Fix t/db_dependent/Template/Plugin/Categories.t > >These tests fail since commit 6ee8dd3a597d08ccc5122473e55790d3f21d5163 > Bug 15407: Koha::Patron::Categories - replace C4::Category->all > >Indeed the patron categories plugin now returns a >Koha::Patron::Categories object and does not set a 'selected' flag. >We do not need this flag (`git grep Categories.all **/*.tt` to trust me) > >Note that this patch also add a patron category to make the test passes >even if no category exist. > >Test plan: > prove t/db_dependent/Template/Plugin/Categories.t >should return green >--- > t/db_dependent/Template/Plugin/Categories.t | 21 +++++++++------------ > 1 file changed, 9 insertions(+), 12 deletions(-) > >diff --git a/t/db_dependent/Template/Plugin/Categories.t b/t/db_dependent/Template/Plugin/Categories.t >index 6e495ed..014cab2 100644 >--- a/t/db_dependent/Template/Plugin/Categories.t >+++ b/t/db_dependent/Template/Plugin/Categories.t >@@ -1,22 +1,19 @@ > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 1; > >-use C4::Context; >+use Koha::Database; > use Koha::Template::Plugin::Categories; >+use t::lib::TestBuilder; > >-my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; >+$builder->build({ source => 'Category' }); > > my @categories = Koha::Template::Plugin::Categories->new->all; > isnt( scalar( @categories ), 0, 'Plugin Categories should return categories' ); > my $selected_categories = [ grep { $_->{selected} } @categories ]; >-is( scalar( @$selected_categories ), 0, 'Plugin Categories should not select one if not given' ); > >-my $category = $categories[-1]; >-@categories = Koha::Template::Plugin::Categories->new->all({selected => $category->{categorycode}}); >-isnt( scalar( @categories ), 0, 'Plugin Categories should return categories if selected needed' ); >-$selected_categories = [ grep { $_->{selected} } @categories ]; >-is( scalar( @$selected_categories ), 1, 'Plugin Categories should select only 1 category' ); >-is( $selected_categories->[0]->{categorycode}, $category->{categorycode}, 'Plugin Categories should select the good one' ); >+$schema->storage->txn_rollback; >-- >2.1.4
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 17640
:
57530
|
57537
|
57555
|
57556
|
57557
|
57558
|
57559
|
57567