1 package KohaTest::Koha::get_itemtypeinfos_of;
2 use base qw( KohaTest::Koha );
13 calls get_itemtypeinfos_of on one item type and checks that it gets
18 sub get_one : Test( 8 ) {
21 my $itemtype_info = C4::Koha::get_itemtypeinfos_of( 'BK' );
22 ok( $itemtype_info, 'we got back something from get_itemtypeinfos_of' );
23 isa_ok( $itemtype_info, 'HASH', '...and it' );
24 ok( exists $itemtype_info->{'BK'}, '...and it has a BK key' )
25 or diag( Data::Dumper->Dump( [ $itemtype_info ], [ 'itemtype_info' ] ) );
26 is( scalar keys %$itemtype_info, 1, '...and it has 1 key' );
27 foreach my $key ( qw( imageurl itemtype notforloan description ) ) {
28 ok( exists $itemtype_info->{'BK'}{$key}, "...and the BK info has a $key key" );
35 calls get_itemtypeinfos_of on a list of item types and verifies the
40 sub get_two : Test( 13 ) {
43 my @itemtypes = qw( BK MU );
44 my $itemtype_info = C4::Koha::get_itemtypeinfos_of( @itemtypes );
45 ok( $itemtype_info, 'we got back something from get_itemtypeinfos_of' );
46 isa_ok( $itemtype_info, 'HASH', '...and it' );
47 is( scalar keys %$itemtype_info, scalar @itemtypes, '...and it has ' . scalar @itemtypes . ' keys' );
48 foreach my $it ( @itemtypes ) {
49 ok( exists $itemtype_info->{$it}, "...and it has a $it key" )
50 or diag( Data::Dumper->Dump( [ $itemtype_info ], [ 'itemtype_info' ] ) );
51 foreach my $key ( qw( imageurl itemtype notforloan description ) ) {
52 ok( exists $itemtype_info->{$it}{$key}, "...and the $it info has a $key key" );