View | Details | Raw Unified | Return to bug 17944
Collapse All | Expand All

(-)a/t/db_dependent/Koha/ItemTypes.t (-8 / +10 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 18;
22
use Test::More tests => 20;
23
use Data::Dumper;
23
use Data::Dumper;
24
use Koha::Database;
24
use Koha::Database;
25
use Koha::Items;
25
use Koha::Items;
Lines 78-84 Koha::Item->new( Link Here
78
        itemnumber => 1,
78
        itemnumber => 1,
79
        biblionumber => 1,
79
        biblionumber => 1,
80
        biblioitemnumber  =>1,
80
        biblioitemnumber  =>1,
81
        itype        => 'type2',
81
        itype        => 'type1',
82
        notforloan   => 1,
82
        notforloan   => 1,
83
        itemlost     => 0, 
83
        itemlost     => 0, 
84
    }
84
    }
Lines 106-113 is( $type->checkinmsg, 'checkinmsg', 'checkinmsg' ); Link Here
106
is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' );
106
is( $type->checkinmsgtype, 'checkinmsgtype', 'checkinmsgtype' );
107
107
108
108
109
subtest is_used => sub{
109
sub is_used {
110
    plan test => 2;
110
    require Test::More;
111
    my $itemtype_code = shift;
111
    my $itemtype_code = shift;
112
    my $schema = Koha::Database->new()->schema();
112
    my $schema = Koha::Database->new()->schema();
113
    my $itemtotal = Koha::Items->search({ 'itype' => $itemtype_code })->count;
113
    my $itemtotal = Koha::Items->search({ 'itype' => $itemtype_code })->count;
Lines 115-122 subtest is_used => sub{ Link Here
115
    my $overalltotal = $itemtotal + $bibliototal;
115
    my $overalltotal = $itemtotal + $bibliototal;
116
    return $overalltotal;
116
    return $overalltotal;
117
}
117
}
118
for my $itemtype_code ('type1', 'type 2') {
118
my $passcount = is_used('type1');
119
        subtest "is_used $itemtype_code", \&is_used, $range;
119
is ( $passcount,    2,    'Exists in the database, test is successful');
120
}
120
121
my $failcount = is_used('type2');
122
is ( $failcount,    0,      'Doesnt exist in database, test is success');
123
121
124
122
$schema->txn_rollback;
125
$schema->txn_rollback;
123
- 

Return to bug 17944