|
Lines 16-21
use C4::Budgets;
Link Here
|
| 16 |
use C4::Items; |
16 |
use C4::Items; |
| 17 |
use Koha::DateUtils; |
17 |
use Koha::DateUtils; |
| 18 |
use Koha::Acquisition::Booksellers; |
18 |
use Koha::Acquisition::Booksellers; |
|
|
19 |
use Koha::Serials; |
| 19 |
use t::lib::Mocks; |
20 |
use t::lib::Mocks; |
| 20 |
use Test::More tests => 50; |
21 |
use Test::More tests => 50; |
| 21 |
use t::lib::TestBuilder; |
22 |
use t::lib::TestBuilder; |
|
Lines 31-38
my $dbh = C4::Context->dbh;
Link Here
|
| 31 |
$dbh->{AutoCommit} = 0; |
32 |
$dbh->{AutoCommit} = 0; |
| 32 |
$dbh->{RaiseError} = 1; |
33 |
$dbh->{RaiseError} = 1; |
| 33 |
|
34 |
|
| 34 |
my $builder = t::lib::TestBuilder->new(); |
|
|
| 35 |
|
| 36 |
# This could/should be used for all untested methods |
35 |
# This could/should be used for all untested methods |
| 37 |
my @methods = ('updateClaim'); |
36 |
my @methods = ('updateClaim'); |
| 38 |
can_ok('C4::Serials', @methods); |
37 |
can_ok('C4::Serials', @methods); |
|
Lines 371-395
subtest "Test GetSerialItemsInformations " => sub {
Link Here
|
| 371 |
AddItem2Serial($serialid[0],$itemnumber1); |
370 |
AddItem2Serial($serialid[0],$itemnumber1); |
| 372 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
371 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
| 373 |
is (scalar @result, 1 , "GetSerialItemsInformation return right length of array using 1 serial with 1 item"); |
372 |
is (scalar @result, 1 , "GetSerialItemsInformation return right length of array using 1 serial with 1 item"); |
| 374 |
is (@result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
373 |
is ($result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
| 375 |
AddItem2Serial($serialid[1],$itemnumber3); |
374 |
AddItem2Serial($serialid[1],$itemnumber3); |
| 376 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
375 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
| 377 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 1 item"); |
376 |
is (scalar @result, 2 , "GetSerialItemsInformation 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"); |
377 |
is ($result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
| 379 |
is (@result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
378 |
is ($result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
| 380 |
}; |
379 |
}; |
| 381 |
subtest "Test with 2 serials and each have 2 items" => sub { |
380 |
subtest "Test with 2 serials and each have 2 items" => sub { |
| 382 |
plan tests => 6; |
381 |
plan tests => 6; |
| 383 |
AddItem2Serial($serialid[0],$itemnumber2); |
382 |
AddItem2Serial($serialid[0],$itemnumber2); |
| 384 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
383 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
| 385 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials "); |
384 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials "); |
| 386 |
is (@result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
385 |
is ($result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
| 387 |
is (@result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
386 |
is ($result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
| 388 |
AddItem2Serial($serialid[1],$itemnumber4); |
387 |
AddItem2Serial($serialid[1],$itemnumber4); |
| 389 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
388 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
| 390 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 2 items "); |
389 |
is (scalar @result, 2 , "GetSerialItemsInformation 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"); |
390 |
is ($result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
| 392 |
is (@result[1]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial2"); |
391 |
is ($result[1]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial2"); |
| 393 |
}; |
392 |
}; |
| 394 |
}; |
393 |
}; |
| 395 |
|
394 |
|
| 396 |
- |
|
|