diff --git a/t/lib/KohaTest.pm b/t/lib/KohaTest.pm index 7da83614dd..d42141c6a6 100644 --- a/t/lib/KohaTest.pm +++ b/t/lib/KohaTest.pm @@ -582,6 +582,11 @@ sub add_biblios { is( $iteminfo[0], $biblionumber, "biblionumber is $biblionumber" ); is( $iteminfo[1], $biblioitemnumber, "biblioitemnumber is $biblioitemnumber" ); ok( $iteminfo[2], "itemnumber is $iteminfo[2]" ); + push @{ $self->{'items'} }, + { biblionumber => $iteminfo[0], + biblioitemnumber => $iteminfo[1], + itemnumber => $iteminfo[2], + }; } push @{$self->{'biblios'}}, $biblionumber; } diff --git a/t/lib/KohaTest/Items/GetItemsForInventory.pm b/t/lib/KohaTest/Items/GetItemsForInventory.pm index 03cb4a1907..a56057ec23 100644 --- a/t/lib/KohaTest/Items/GetItemsForInventory.pm +++ b/t/lib/KohaTest/Items/GetItemsForInventory.pm @@ -23,10 +23,10 @@ sub startup_90_add_item_get_callnumber : Test( startup => 13 ) { $self->add_biblios( add_items => 1 ); - ok( $self->{'biblios'}, 'An item has been aded' ) - or diag( Data::Dumper->Dump( [ $self->{'biblios'} ], ['biblios'] ) ); + ok( $self->{'items'}, 'An item has been aded' ) + or diag( Data::Dumper->Dump( [ $self->{'items'} ], ['items'] ) ); - my @biblioitems = C4::Biblio::GetBiblioItemByBiblioNumber( $self->{'biblios'}[0] ); + my @biblioitems = C4::Biblio::GetBiblioItemByBiblioNumber( $self->{'items'}[0]{'biblionumber'} ); ok( $biblioitems[0]->{'biblioitemnumber'}, '...and it has a biblioitemnumber' ) or diag( Data::Dumper->Dump( [ \@biblioitems ], ['biblioitems'] ) ); @@ -60,7 +60,7 @@ sub missing_parameters : Test( 1 ) { local $TODO = 'GetItemsForInventory should fail when missing required parameters'; my $items = C4::Items::GetItemsForInventory(); - ok( not $items, 'GetItemsForInventory fails when parameters are missing' ) + ok( ! defined $items, 'GetItemsForInventory fails when parameters are missing' ) or diag( Data::Dumper->Dump( [ $items ], [ 'items' ] ) ); } @@ -77,9 +77,9 @@ sub basic_usage : Test( 4 ) { isa_ok( $items, 'ARRAY', 'We were able to call GetItemsForInventory with our call number' ); is( scalar @$items, 1, '...and we found only one item' ); my $our_item = $items->[0]; - is( $our_item->{'itemnumber'}, $self->{'biblios'}[0], '...and the item we found has the right itemnumber' ); + is( $our_item->{'itemnumber'}, $self->{'items'}[0]{'itemnumber'}, '...and the item we found has the right itemnumber' ); - diag( Data::Dumper->Dump( [$items], ['items'] ) ); + # diag( Data::Dumper->Dump( [$items], ['items'] ) ); } =head3 date_last_seen @@ -103,7 +103,7 @@ sub date_last_seen : Test( 6 ) { isa_ok( $items, 'ARRAY', 'We were able to call GetItemsForInventory with our call number' ); is( scalar @$items, 1, '...and we found only one item' ); my $our_item = $items->[0]; - is( $our_item->{'itemnumber'}, $self->{'biblios'}[0], '...and the item we found has the right itemnumber' ); + is( $our_item->{'itemnumber'}, $self->{'items'}[0]{'itemnumber'}, '...and the item we found has the right itemnumber' ); # give a datelastseen of yesterday, and we should not get our item. $items = C4::Items::GetItemsForInventory(