From 429de2ab7ff95404cd7c5af1695f872640def129 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Fri, 21 Apr 2017 09:20:07 +1200 Subject: [PATCH] Bug 17944 -Integrated the removal of SQL from itemtypes.pl admin script with the onboarding tool following tester feedback of merge conflict --- t/db_dependent/Koha/ItemTypes.t | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/t/db_dependent/Koha/ItemTypes.t b/t/db_dependent/Koha/ItemTypes.t index 76fde51..0d44f27 100755 --- a/t/db_dependent/Koha/ItemTypes.t +++ b/t/db_dependent/Koha/ItemTypes.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 20; +use Test::More tests => 22; use Data::Dumper; use Koha::Database; use t::lib::Mocks; @@ -117,7 +117,7 @@ Koha::Item->new( itemnumber => 1, biblionumber => 1, biblioitemnumber =>1, - itype => 'type2', + itype => 'type1', notforloan => 1, itemlost => 0, } @@ -155,8 +155,8 @@ is( 'item types should be sorted by translated description' ); -subtest is_used => sub{ - plan test => 2; +sub is_used { + require Test::More; my $itemtype_code = shift; my $schema = Koha::Database->new()->schema(); my $itemtotal = Koha::Items->search({ 'itype' => $itemtype_code })->count; @@ -164,8 +164,11 @@ subtest is_used => sub{ my $overalltotal = $itemtotal + $bibliototal; return $overalltotal; } -for my $itemtype_code ('type1', 'type 2') { - subtest "is_used $itemtype_code", \&is_used, $range; -} + +my $passcount = is_used('type1'); +is ( $passcount,2,'Exists in the database, test is successful'); + +my $failcount = is_used('type2'); +is ( $failcount,0,'Doesnt exist in database, test is success'); $schema->txn_rollback; -- 2.1.4