Lines 348-356
subtest "Do not generate an expected if one already exists" => sub {
Link Here
|
348 |
is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); |
348 |
is( @serialsByStatus, 1, "ModSerialStatus delete corectly serial expected and not create another if exists" ); |
349 |
}; |
349 |
}; |
350 |
|
350 |
|
351 |
subtest "Test GetSerialItemsInformations " => sub { |
351 |
subtest "Test get_serial_items_count " => sub { |
352 |
plan tests => 4; |
352 |
plan tests => 4; |
353 |
is (Koha::Serials::GetSerialItemsInformations(),0,"test GetSerialItemsInformation with nothing parameters "); |
353 |
is (Koha::Serials::get_serial_items_count(),0,"test get_serial_items_count with nothing parameters "); |
354 |
my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; |
354 |
my $branchcode = $builder->build({ source => 'Branch' })->{ branchcode }; |
355 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype }; |
355 |
my $itemtype = $builder->build({ source => 'Itemtype' })->{ itemtype }; |
356 |
my ($biblionumber1, $bibitemnumber) = AddBiblio(MARC::Record->new, ''); |
356 |
my ($biblionumber1, $bibitemnumber) = AddBiblio(MARC::Record->new, ''); |
Lines 365-395
subtest "Test GetSerialItemsInformations " => sub {
Link Here
|
365 |
my $itemnumber3 = AddItem({ barcode => '0103', %item_infos }, $biblionumber1); |
365 |
my $itemnumber3 = AddItem({ barcode => '0103', %item_infos }, $biblionumber1); |
366 |
my $itemnumber4 = AddItem({ barcode => '0104', %item_infos }, $biblionumber1); |
366 |
my $itemnumber4 = AddItem({ barcode => '0104', %item_infos }, $biblionumber1); |
367 |
my @serialid = ($serials[0]->{serialid},$serials[1]->{serialid}); |
367 |
my @serialid = ($serials[0]->{serialid},$serials[1]->{serialid}); |
368 |
is (Koha::Serials::GetSerialItemsInformations(@serialid),0,"test GetSerialItemsInformation with array of serialid and none have items"); |
368 |
is (Koha::Serials::get_serial_items_count(@serialid),0,"test get_serial_items_count with array of serialid and none have items"); |
369 |
subtest "Test with 2 serials and each have one item" => sub { |
369 |
subtest "Test with 2 serials and each have one item" => sub { |
370 |
plan tests => 5; |
370 |
plan tests => 5; |
371 |
AddItem2Serial($serialid[0],$itemnumber1); |
371 |
AddItem2Serial($serialid[0],$itemnumber1); |
372 |
my @result = Koha::Serials::GetSerialItemsInformations(@serialid); |
372 |
my @result = Koha::Serials::get_serial_items_count(@serialid); |
373 |
is (scalar @result, 1 , "GetSerialItemsInformation return right length of array using 1 serial with 1 item"); |
373 |
is (scalar @result, 1 , "get_serial_items_count return right length of array using 1 serial with 1 item"); |
374 |
is ($result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
374 |
is ($result[0]->{countitems}, 1 , "get_serial_items_count return right number items of serial1"); |
375 |
AddItem2Serial($serialid[1],$itemnumber3); |
375 |
AddItem2Serial($serialid[1],$itemnumber3); |
376 |
@result = Koha::Serials::GetSerialItemsInformations(@serialid); |
376 |
@result = Koha::Serials::get_serial_items_count(@serialid); |
377 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 1 item"); |
377 |
is (scalar @result, 2 , "get_serial_items_count return right length of array using 2 serials and each have 1 item"); |
378 |
is ($result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
378 |
is ($result[0]->{countitems}, 1 , "get_serial_items_count return right number items of serial1"); |
379 |
is ($result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
379 |
is ($result[1]->{countitems}, 1 , "get_serial_items_count return right number items of serial2"); |
380 |
}; |
380 |
}; |
381 |
subtest "Test with 2 serials and each have 2 items" => sub { |
381 |
subtest "Test with 2 serials and each have 2 items" => sub { |
382 |
plan tests => 6; |
382 |
plan tests => 6; |
383 |
AddItem2Serial($serialid[0],$itemnumber2); |
383 |
AddItem2Serial($serialid[0],$itemnumber2); |
384 |
my @result = Koha::Serials::GetSerialItemsInformations(@serialid); |
384 |
my @result = Koha::Serials::get_serial_items_count(@serialid); |
385 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials "); |
385 |
is (scalar @result, 2 , "get_serial_items_count return right length of array using 2 serials "); |
386 |
is ($result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
386 |
is ($result[0]->{countitems}, 2 , "get_serial_items_count return right number items of serial1"); |
387 |
is ($result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
387 |
is ($result[1]->{countitems}, 1 , "get_serial_items_count return right number items of serial2"); |
388 |
AddItem2Serial($serialid[1],$itemnumber4); |
388 |
AddItem2Serial($serialid[1],$itemnumber4); |
389 |
@result = Koha::Serials::GetSerialItemsInformations(@serialid); |
389 |
@result = Koha::Serials::get_serial_items_count(@serialid); |
390 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 2 items "); |
390 |
is (scalar @result, 2 , "get_serial_items_count return right length of array using 2 serials and each have 2 items "); |
391 |
is ($result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
391 |
is ($result[0]->{countitems}, 2 , "get_serial_items_count return right number items of serial1"); |
392 |
is ($result[1]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial2"); |
392 |
is ($result[1]->{countitems}, 2 , "get_serial_items_count return right number items of serial2"); |
393 |
}; |
393 |
}; |
394 |
}; |
394 |
}; |
395 |
|
395 |
|
396 |
- |
|
|