From 29c349c8d5f37b08d8552e67b0eb2195936ce69f Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Mon, 25 Apr 2016 12:00:13 -0600 Subject: [PATCH] Bug 12748: (QA followup) make new tests pass * t/Koha/ItemType.pm: * Rename to .t * Fix method names * t/db_dependent/Koha/ItemTypes.t: Fix method names and Koha::Database usage Signed-off-by: Jesse Weaver Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall --- t/Koha/{ItemType.pm => ItemType.t} | 2 +- t/db_dependent/Koha/ItemTypes.t | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 13 deletions(-) rename t/Koha/{ItemType.pm => ItemType.t} (95%) diff --git a/t/Koha/ItemType.pm b/t/Koha/ItemType.t similarity index 95% rename from t/Koha/ItemType.pm rename to t/Koha/ItemType.t index e47d5e26cb..ae9481236b 100755 --- a/t/Koha/ItemType.pm +++ b/t/Koha/ItemType.t @@ -37,7 +37,7 @@ my $data = { my $type = Koha::ItemType->new($data); -is( $type->code, 'CODE', 'itemtype/code' ); +is( $type->itemtype, 'CODE', 'itemtype/code' ); is( $type->description, 'description', 'description' ); is( $type->rentalcharge, 'rentalcharge', 'rentalcharge' ); is( $type->imageurl, 'imageurl', 'imageurl' ); diff --git a/t/db_dependent/Koha/ItemTypes.t b/t/db_dependent/Koha/ItemTypes.t index b6e61bcc13..9ce1ad6a2e 100755 --- a/t/db_dependent/Koha/ItemTypes.t +++ b/t/db_dependent/Koha/ItemTypes.t @@ -19,11 +19,12 @@ use Modern::Perl; -use Test::More tests => 17; +use Test::More tests => 18; use Data::Dumper; use Koha::Database; BEGIN { + use_ok('Koha::ItemType'); use_ok('Koha::ItemTypes'); } @@ -31,7 +32,7 @@ my $database = Koha::Database->new(); my $schema = $database->schema(); $schema->txn_begin; -$schema->resultset('Itemtype')->create( +Koha::ItemType->new( { itemtype => 'type1', description => 'description', @@ -41,8 +42,9 @@ $schema->resultset('Itemtype')->create( checkinmsg => 'checkinmsg', checkinmsgtype => 'checkinmsgtype', } -); -$schema->resultset('Itemtype')->create( +)->store; + +Koha::ItemType->new( { itemtype => 'type2', description => 'description', @@ -52,14 +54,11 @@ $schema->resultset('Itemtype')->create( checkinmsg => 'checkinmsg', checkinmsgtype => 'checkinmsgtype', } -); -my $itypes = Koha::ItemTypes->new(); - -my @types = $itypes->get_itemtype( 'type1', 'type2' ); +)->store; -my $type = $types[0]; +my $type = Koha::ItemTypes->find('type1'); ok( defined($type), 'first result' ); -is( $type->code, 'type1', 'itemtype/code' ); +is( $type->itemtype, 'type1', 'itemtype/code' ); is( $type->description, 'description', 'description' ); is( $type->rentalcharge, '0.0000', 'rentalcharge' ); is( $type->imageurl, 'imageurl', 'imageurl' ); @@ -67,9 +66,9 @@ is( $type->summary, 'summary', 'summary' ); is( $type->checkinmsg, 'checkinmsg', 'checkinmsg' ); is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' ); -$type = $types[1]; +$type = Koha::ItemTypes->find('type2'); ok( defined($type), 'second result' ); -is( $type->code, 'type2', 'itemtype/code' ); +is( $type->itemtype, 'type2', 'itemtype/code' ); is( $type->description, 'description', 'description' ); is( $type->rentalcharge, '0.0000', 'rentalcharge' ); is( $type->imageurl, 'imageurl', 'imageurl' ); -- 2.20.1