Bugzilla – Attachment 28624 Details for
Bug 10937
Advanced search: Hide itemtypes from search form & Group itemtypes together into one search option
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10937 - Add unit tests.
Bug-10937---Add-unit-tests.patch (text/plain), 2.79 KB, created by
Blou
on 2014-06-02 20:13:18 UTC
(
hide
)
Description:
Bug 10937 - Add unit tests.
Filename:
MIME Type:
Creator:
Blou
Created:
2014-06-02 20:13:18 UTC
Size:
2.79 KB
patch
obsolete
>From c90dcfe574e45d2b5eb0380815feedc79540c28d Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Mon, 2 Jun 2014 15:58:34 -0400 >Subject: [PATCH] Bug 10937 - Add unit tests. > >Modified t/db_dependant/Koha.t to test the two new functions from C4/Koha.pm. >--- > t/db_dependent/Koha.t | 35 +++++++++++++++++++++++++++++++++-- > 1 file changed, 33 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Koha.t b/t/db_dependent/Koha.t >index 0e90403..71d3bbb 100644 >--- a/t/db_dependent/Koha.t >+++ b/t/db_dependent/Koha.t >@@ -8,11 +8,11 @@ use warnings; > use C4::Context; > use Koha::DateUtils qw(dt_from_string); > >-use Test::More tests => 7; >+use Test::More tests => 8; > use DateTime::Format::MySQL; > > BEGIN { >- use_ok('C4::Koha', qw( :DEFAULT GetDailyQuote )); >+ use_ok('C4::Koha', qw( :DEFAULT GetDailyQuote GetItemTypesByCategory GetItemTypesCategorized)); > use_ok('C4::Members'); > } > >@@ -261,3 +261,34 @@ subtest 'getFacets() tests' => sub { > 'location facet present with singleBranchMode on (bug 10078)' > ); > }; >+ >+subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{ >+ plan tests => 7; >+ >+ my $insertGroup = AddAuthorisedValue('DOCTYPECAT', 'Qwertyware'); >+ ok($insertGroup, "Create group Qwertyware"); >+ >+ my $query = "INSERT into itemtypes (itemtype, description, searchcategory, hideinopac) values (?,?,?,?)"; >+ my $insertSth = C4::Context->dbh->prepare($query); >+ $insertSth->execute('BKghjklo1', 'One type of book', '', 0); >+ $insertSth->execute('BKghjklo2', 'Another type of book', 'Qwertyware', 0); >+ $insertSth->execute('BKghjklo3', 'Yet another type of book', 'Qwertyware', 0); >+ # test for empty result >+ my @results = GetItemTypesByCategory('Azertyware'); >+ is(scalar @results, 0, 'GetItemTypesByCategory: Invalid category returns nothing'); >+ @results = GetItemTypesByCategory('Qwertyware'); >+ is($results[1], 'BKghjklo3', 'GetItemTypesByCategory: valid category returns itemtypes'); >+ >+ # add more data since GetItemTypesCategorized's search is more subtle >+ $insertSth->execute('BKghjklo4', 'An hidden book', 'Qwertyware', 1); >+ AddAuthorisedValue('DOCTYPECAT', 'Veryveryheavybook'); >+ $insertSth->execute('BKghjklo5', 'Some encyclopedia', 'Veryveryheavybook', 0); >+ $insertSth->execute('BKghjklo6', 'A collection of dictionnary', 'Veryveryheavybook', 0); >+ # get the grouped itemtypes. >+ my $hrCat = GetItemTypesCategorized(); >+ ok(exists $hrCat->{Qwertyware}, 'GetItemTypesCategorized: first category exists'); >+ ok(exists $hrCat->{Veryveryheavybook}, 'GetItemTypesCategorized: second category exists'); >+ ok(exists $hrCat->{BKghjklo1}, 'GetItemTypesCategorized: ungrouped item exists'); >+ ok(!exists $hrCat->{BKghjklo2}, 'GetItemTypesCategorized: grouped itemtype not returned'); >+} >+ >-- >1.7.9.5
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 10937
:
22007
|
22276
|
24596
|
24597
|
24778
|
24779
|
24782
|
28571
|
28572
|
28573
|
28575
|
28576
|
28579
|
28624
|
28626
|
29383
|
30308
|
31896
|
34419
|
34635
|
34667
|
35452
|
36191
|
36240
|
36856
|
40884
|
42323