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 <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
6eec9dc155
commit
29c349c8d5
|
|
@ -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' );
|
||||
|
|
@ -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();
|
||||
)->store;
|
||||
|
||||
my @types = $itypes->get_itemtype( 'type1', 'type2' );
|
||||
|
||||
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' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue