Bug 23463: Fix tests
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
de9ce93cf2
commit
974caa4304
4 changed files with 36 additions and 34 deletions
|
@ -70,7 +70,7 @@ Koha::CirculationRules->set_rule(
|
||||||
|
|
||||||
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
|
subtest "AddReturn logging on statistics table (item-level_itypes=1)" => sub {
|
||||||
|
|
||||||
plan tests => 4;
|
plan tests => 3;
|
||||||
|
|
||||||
# Set item-level item types
|
# Set item-level item types
|
||||||
t::lib::Mocks::mock_preference( "item-level_itypes", 1 );
|
t::lib::Mocks::mock_preference( "item-level_itypes", 1 );
|
||||||
|
|
|
@ -827,25 +827,26 @@ subtest 'CanItemBeReserved / branch_not_in_hold_group' => sub {
|
||||||
|
|
||||||
# Create 3 biblios with items
|
# Create 3 biblios with items
|
||||||
my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
||||||
my ( undef, undef, $itemnumber_1 ) = AddItem(
|
my $item_1 = $builder->build_sample_item(
|
||||||
{ homebranch => $library1->branchcode,
|
{
|
||||||
holdingbranch => $library1->branchcode
|
biblionumber => $biblio_1->biblionumber,
|
||||||
},
|
library => $library1->branchcode
|
||||||
$biblio_1->biblionumber
|
}
|
||||||
);
|
);
|
||||||
my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype2->itemtype });
|
my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype2->itemtype });
|
||||||
my ( undef, undef, $itemnumber_2 ) = AddItem(
|
my $item_2 = $builder->build_sample_item(
|
||||||
{ homebranch => $library2->branchcode,
|
{
|
||||||
holdingbranch => $library2->branchcode
|
biblionumber => $biblio_2->biblionumber,
|
||||||
},
|
library => $library2->branchcode
|
||||||
$biblio_2->biblionumber
|
}
|
||||||
);
|
);
|
||||||
|
my $itemnumber_2 = $item_2->itemnumber;
|
||||||
my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
||||||
my ( undef, undef, $itemnumber_3 ) = AddItem(
|
my $item_3 = $builder->build_sample_item(
|
||||||
{ homebranch => $library1->branchcode,
|
{
|
||||||
holdingbranch => $library1->branchcode
|
biblionumber => $biblio_3->biblionumber,
|
||||||
},
|
library => $library1->branchcode
|
||||||
$biblio_3->biblionumber
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
# Test 1: Patron 3 can place hold
|
# Test 1: Patron 3 can place hold
|
||||||
|
@ -1047,25 +1048,26 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub {
|
||||||
|
|
||||||
# Create 3 biblios with items
|
# Create 3 biblios with items
|
||||||
my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
my $biblio_1 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
||||||
my ( undef, undef, $itemnumber_1 ) = AddItem(
|
my $item_1 = $builder->build_sample_item(
|
||||||
{ homebranch => $library1->branchcode,
|
{
|
||||||
holdingbranch => $library1->branchcode
|
biblionumber => $biblio_1->biblionumber,
|
||||||
},
|
library => $library1->branchcode
|
||||||
$biblio_1->biblionumber
|
}
|
||||||
);
|
);
|
||||||
my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype2->itemtype });
|
my $biblio_2 = $builder->build_sample_biblio({ itemtype => $itemtype2->itemtype });
|
||||||
my ( undef, undef, $itemnumber_2 ) = AddItem(
|
my $item_2 = $builder->build_sample_item(
|
||||||
{ homebranch => $library2->branchcode,
|
{
|
||||||
holdingbranch => $library2->branchcode
|
biblionumber => $biblio_2->biblionumber,
|
||||||
},
|
library => $library2->branchcode
|
||||||
$biblio_2->biblionumber
|
}
|
||||||
);
|
);
|
||||||
|
my $itemnumber_2 = $item_2->itemnumber;
|
||||||
my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
my $biblio_3 = $builder->build_sample_biblio({ itemtype => $itemtype1->itemtype });
|
||||||
my ( undef, undef, $itemnumber_3 ) = AddItem(
|
my $item_3 = $builder->build_sample_item(
|
||||||
{ homebranch => $library1->branchcode,
|
{
|
||||||
holdingbranch => $library1->branchcode
|
biblionumber => $biblio_3->biblionumber,
|
||||||
},
|
library => $library1->branchcode
|
||||||
$biblio_3->biblionumber
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
# Test 1: Patron 3 can place hold
|
# Test 1: Patron 3 can place hold
|
||||||
|
|
|
@ -60,7 +60,7 @@ my $itemnumber1 = $builder->build_sample_item({ biblionumber => $biblionumber1,
|
||||||
my $itemnumber2 = $builder->build_sample_item({ biblionumber => $biblionumber1, barcode => '0102', %item_infos })->itemnumber;
|
my $itemnumber2 = $builder->build_sample_item({ biblionumber => $biblionumber1, barcode => '0102', %item_infos })->itemnumber;
|
||||||
|
|
||||||
my ($biblionumber2) = AddBiblio( MARC::Record->new, '' );
|
my ($biblionumber2) = AddBiblio( MARC::Record->new, '' );
|
||||||
my $itemnumber2 = $builder->build_sample_item({ biblionumber => $biblionumber2, barcode => '0202', %item_infos })->itemnumber;
|
my $itemnumber3 = $builder->build_sample_item({ biblionumber => $biblionumber2, barcode => '0202', %item_infos })->itemnumber;
|
||||||
|
|
||||||
my $borrowernumber1 =
|
my $borrowernumber1 =
|
||||||
Koha::Patron->new({ categorycode => $categorycode, branchcode => $branchcode })->store->borrowernumber;
|
Koha::Patron->new({ categorycode => $categorycode, branchcode => $branchcode })->store->borrowernumber;
|
||||||
|
@ -100,7 +100,7 @@ is( $issues->[1]->{itemnumber}, $itemnumber2, '' );
|
||||||
$issues = C4::Members::GetAllIssues($borrowernumber2);
|
$issues = C4::Members::GetAllIssues($borrowernumber2);
|
||||||
is( @$issues, 0, 'GetAllIssues returns the correct number of elements' );
|
is( @$issues, 0, 'GetAllIssues returns the correct number of elements' );
|
||||||
|
|
||||||
AddIssue( $borrower2, '0203' );
|
AddIssue( $borrower2, '0202' );
|
||||||
$issues = C4::Members::GetAllIssues($borrowernumber1);
|
$issues = C4::Members::GetAllIssues($borrowernumber1);
|
||||||
is( @$issues, 2, 'GetAllIssues returns the correct number of elements' );
|
is( @$issues, 2, 'GetAllIssues returns the correct number of elements' );
|
||||||
is( $issues->[0]->{itemnumber}, $itemnumber1, '' );
|
is( $issues->[0]->{itemnumber}, $itemnumber1, '' );
|
||||||
|
|
|
@ -404,7 +404,7 @@ is($new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 1
|
||||||
|
|
||||||
# avoiding the not_same_branch error
|
# avoiding the not_same_branch error
|
||||||
t::lib::Mocks::mock_preference('IndependentBranches', 0);
|
t::lib::Mocks::mock_preference('IndependentBranches', 0);
|
||||||
my $item = Koha::Items->find($itemnumber);
|
$item = Koha::Items->find($item->itemnumber);
|
||||||
is(
|
is(
|
||||||
$item->safe_delete,
|
$item->safe_delete,
|
||||||
'book_reserved',
|
'book_reserved',
|
||||||
|
|
Loading…
Reference in a new issue