Bugzilla – Attachment 38108 Details for
Bug 7380
Can't filter patron search on detail page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 7380: Add tests for TT plugins
PASSED-QA-Bug-7380-Add-tests-for-TT-plugins.patch (text/plain), 3.32 KB, created by
Katrin Fischer
on 2015-04-17 20:43:19 UTC
(
hide
)
Description:
[PASSED QA] Bug 7380: Add tests for TT plugins
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-04-17 20:43:19 UTC
Size:
3.32 KB
patch
obsolete
>From 56b57c7981106df8e2394105e3c1505ac834b63c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 17 Apr 2015 17:40:07 +0200 >Subject: [PATCH] [PASSED QA] Bug 7380: Add tests for TT plugins > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > t/db_dependent/Template/Plugin/Branches.t | 35 +++++++++++++++++++++++++++++ > t/db_dependent/Template/Plugin/Categories.t | 23 +++++++++++++++++++ > 2 files changed, 58 insertions(+) > create mode 100644 t/db_dependent/Template/Plugin/Branches.t > create mode 100644 t/db_dependent/Template/Plugin/Categories.t > >diff --git a/t/db_dependent/Template/Plugin/Branches.t b/t/db_dependent/Template/Plugin/Branches.t >new file mode 100644 >index 0000000..5b77d59 >--- /dev/null >+++ b/t/db_dependent/Template/Plugin/Branches.t >@@ -0,0 +1,35 @@ >+use Modern::Perl; >+ >+use Test::More tests => 5; >+ >+use C4::Context; >+use C4::Branch; >+use Koha::Template::Plugin::Branches; >+ >+my $dbh = C4::Context->dbh; >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ >+for my $i ( 1 .. 5 ) { >+ C4::Branch::ModBranch( >+{ >+ branchcode => "test_br_$i", >+ branchname => "test_br_$i", >+ add => 1, >+} >+ ); >+ >+} >+ >+my $branches = Koha::Template::Plugin::Branches->new->all; >+my $test_branches = [ grep { $_->{branchcode} =~ m|^test_br_| } @$branches ]; >+is( scalar( @$test_branches ), 5, 'Plugin Branches should return the branches' ); >+my $selected_branches = [ grep { $_->{selected} } @$branches ]; >+is( scalar( @$selected_branches ), 0, 'Plugin Branches should not select a branch if not needed' ); >+ >+$branches = Koha::Template::Plugin::Branches->new->all({selected => 'test_br_3'}); >+$test_branches = [ grep { $_->{branchcode} =~ m|^test_br_| } @$branches ]; >+is( scalar( @$test_branches ), 5, 'Plugin Branches should return the branches if selected passed' ); >+$selected_branches = [ grep { $_->{selected} } @$branches ]; >+is( scalar( @$selected_branches ), 1, 'Plugin Branches should return only 1 selected if passed' ); >+is( $selected_branches->[0]->{branchcode}, 'test_br_3', 'Plugin Branches should select the good one' ); >diff --git a/t/db_dependent/Template/Plugin/Categories.t b/t/db_dependent/Template/Plugin/Categories.t >new file mode 100644 >index 0000000..3df848a >--- /dev/null >+++ b/t/db_dependent/Template/Plugin/Categories.t >@@ -0,0 +1,23 @@ >+use Modern::Perl; >+ >+use Test::More tests => 5; >+ >+use C4::Context; >+use C4::Branch; >+use Koha::Template::Plugin::Categories; >+ >+my $dbh = C4::Context->dbh; >+$dbh->{AutoCommit} = 0; >+$dbh->{RaiseError} = 1; >+ >+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' ); >-- >1.9.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 7380
:
29697
|
33157
|
35222
|
35259
|
35342
|
37805
|
37806
|
38053
|
38055
|
38056
|
38067
|
38068
|
38090
|
38107
| 38108