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 374-398
subtest "Test GetSerialItemsInformations " => sub {
Link Here
|
374 |
AddItem2Serial($serialid[0],$itemnumber1); |
373 |
AddItem2Serial($serialid[0],$itemnumber1); |
375 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
374 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
376 |
is (scalar @result, 1 , "GetSerialItemsInformation return right length of array using 1 serial with 1 item"); |
375 |
is (scalar @result, 1 , "GetSerialItemsInformation return right length of array using 1 serial with 1 item"); |
377 |
is (@result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
376 |
is ($result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
378 |
AddItem2Serial($serialid[1],$itemnumber3); |
377 |
AddItem2Serial($serialid[1],$itemnumber3); |
379 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
378 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
380 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 1 item"); |
379 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 1 item"); |
381 |
is (@result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
380 |
is ($result[0]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial1"); |
382 |
is (@result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
381 |
is ($result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
383 |
}; |
382 |
}; |
384 |
subtest "Test with 2 serials and each have 2 items" => sub { |
383 |
subtest "Test with 2 serials and each have 2 items" => sub { |
385 |
plan tests => 6; |
384 |
plan tests => 6; |
386 |
AddItem2Serial($serialid[0],$itemnumber2); |
385 |
AddItem2Serial($serialid[0],$itemnumber2); |
387 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
386 |
my @result = C4::Serials::GetSerialItemsInformations(@serialid); |
388 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials "); |
387 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials "); |
389 |
is (@result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
388 |
is ($result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
390 |
is (@result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
389 |
is ($result[1]->{countitems}, 1 , "GetSerialItemsInformation return right number items of serial2"); |
391 |
AddItem2Serial($serialid[1],$itemnumber4); |
390 |
AddItem2Serial($serialid[1],$itemnumber4); |
392 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
391 |
@result = C4::Serials::GetSerialItemsInformations(@serialid); |
393 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 2 items "); |
392 |
is (scalar @result, 2 , "GetSerialItemsInformation return right length of array using 2 serials and each have 2 items "); |
394 |
is (@result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
393 |
is ($result[0]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial1"); |
395 |
is (@result[1]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial2"); |
394 |
is ($result[1]->{countitems}, 2 , "GetSerialItemsInformation return right number items of serial2"); |
396 |
}; |
395 |
}; |
397 |
}; |
396 |
}; |
398 |
|
397 |
|
399 |
- |
|
|