Bug 15337: Add tests to ensure that GetItemTypes will return element ordered by desc

See comment #3
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
Jonathan Druart 2016-01-05 14:23:24 +00:00 committed by Brendan Gallagher
parent e706cd18f0
commit d33c2bf683
1 changed files with 11 additions and 15 deletions

View File

@ -8,7 +8,7 @@ use warnings;
use C4::Context;
use Koha::DateUtils qw(dt_from_string);
use Test::More tests => 9;
use Test::More tests => 10;
use DateTime::Format::MySQL;
BEGIN {
@ -147,20 +147,6 @@ subtest 'Itemtype info Tests' => sub {
like ( getitemtypeinfo('BK', 'opac')->{'imageurl'}, qr/opac-tmpl/, 'getitemtypeinfo on "opac" interface returns opac imageurl' );
};
### test for C4::Koha->GetDailyQuote()
SKIP:
{
@ -353,4 +339,14 @@ subtest 'GetItemTypesByCategory GetItemTypesCategorized test' => sub{
@expected = ( 'BKghjklo1', 'Qwertyware', 'Veryheavybook' );
is_deeply(\@results,\@expected, 'GetItemTypesCategorized: grouped and ungrouped items returned as expected.');
};
subtest 'GetItemTypes test' => sub {
plan tests => 1;
$dbh->do(q|DELETE FROM itemtypes|);
$dbh->do(q|INSERT INTO itemtypes(itemtype, description) VALUES ('a', 'aa desc'), ('b', 'zz desc'), ('d', 'dd desc'), ('c', 'yy desc')|);
my $itemtypes = C4::Koha::GetItemTypes( style => 'array' );
$itemtypes = [ map { $_->{itemtype} } @$itemtypes ];
is_deeply( $itemtypes, [ 'a', 'd', 'c', 'b' ], 'GetItemTypes(array) should return itemtypes ordered by description');
};
$dbh->rollback();