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