|
Lines 263-276
subtest 'add_to_bundle tests' => sub {
Link Here
|
| 263 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
263 |
'Koha::Exceptions::Item::Bundle::IsBundle', |
| 264 |
'Exception thrown if you try to add a bundle host to a bundle item'; |
264 |
'Exception thrown if you try to add a bundle host to a bundle item'; |
| 265 |
|
265 |
|
| 266 |
C4::Circulation::AddIssue( $patron->unblessed, $host_item->barcode ); |
266 |
C4::Circulation::AddIssue( $patron, $host_item->barcode ); |
| 267 |
throws_ok { $host_item->add_to_bundle($bundle_item2) } |
267 |
throws_ok { $host_item->add_to_bundle($bundle_item2) } |
| 268 |
'Koha::Exceptions::Item::Bundle::BundleIsCheckedOut', |
268 |
'Koha::Exceptions::Item::Bundle::BundleIsCheckedOut', |
| 269 |
'Exception thrown if you try to add an item to a checked out bundle'; |
269 |
'Exception thrown if you try to add an item to a checked out bundle'; |
| 270 |
C4::Circulation::AddReturn( $host_item->barcode, $host_item->homebranch ); |
270 |
C4::Circulation::AddReturn( $host_item->barcode, $host_item->homebranch ); |
| 271 |
$host_item->discard_changes; |
271 |
$host_item->discard_changes; |
| 272 |
|
272 |
|
| 273 |
C4::Circulation::AddIssue( $patron->unblessed, $bundle_item2->barcode ); |
273 |
C4::Circulation::AddIssue( $patron, $bundle_item2->barcode ); |
| 274 |
throws_ok { $host_item->add_to_bundle($bundle_item2) } |
274 |
throws_ok { $host_item->add_to_bundle($bundle_item2) } |
| 275 |
'Koha::Exceptions::Item::Bundle::ItemIsCheckedOut', |
275 |
'Koha::Exceptions::Item::Bundle::ItemIsCheckedOut', |
| 276 |
'Exception thrown if you try to add a checked out item'; |
276 |
'Exception thrown if you try to add a checked out item'; |
|
Lines 304-310
subtest 'remove_from_bundle tests' => sub {
Link Here
|
| 304 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
304 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 305 |
t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); |
305 |
t::lib::Mocks::mock_userenv( { branchcode => $patron->branchcode } ); |
| 306 |
|
306 |
|
| 307 |
C4::Circulation::AddIssue( $patron->unblessed, $host_item->barcode ); |
307 |
C4::Circulation::AddIssue( $patron, $host_item->barcode ); |
| 308 |
throws_ok { $bundle_item1->remove_from_bundle } |
308 |
throws_ok { $bundle_item1->remove_from_bundle } |
| 309 |
'Koha::Exceptions::Item::Bundle::BundleIsCheckedOut', |
309 |
'Koha::Exceptions::Item::Bundle::BundleIsCheckedOut', |
| 310 |
'Exception thrown if you try to add an item to a checked out bundle'; |
310 |
'Exception thrown if you try to add an item to a checked out bundle'; |
|
Lines 871-877
subtest 'deletion' => sub {
Link Here
|
| 871 |
$item = $builder->build_sample_item({ library => $library->branchcode }); |
871 |
$item = $builder->build_sample_item({ library => $library->branchcode }); |
| 872 |
|
872 |
|
| 873 |
# book_on_loan |
873 |
# book_on_loan |
| 874 |
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); |
874 |
C4::Circulation::AddIssue( $patron, $item->barcode ); |
| 875 |
|
875 |
|
| 876 |
is( |
876 |
is( |
| 877 |
@{$item->safe_to_delete->messages}[0]->message, |
877 |
@{$item->safe_to_delete->messages}[0]->message, |
|
Lines 1973-1979
subtest 'Recalls tests' => sub {
Link Here
|
| 1973 |
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall item if not checked out" ); |
1973 |
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall item if not checked out" ); |
| 1974 |
|
1974 |
|
| 1975 |
$item1->update({ withdrawn => 0 }); |
1975 |
$item1->update({ withdrawn => 0 }); |
| 1976 |
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode ); |
1976 |
C4::Circulation::AddIssue( $patron2, $item1->barcode ); |
| 1977 |
|
1977 |
|
| 1978 |
Koha::CirculationRules->set_rules({ |
1978 |
Koha::CirculationRules->set_rules({ |
| 1979 |
branchcode => $branchcode, |
1979 |
branchcode => $branchcode, |
|
Lines 2023-2029
subtest 'Recalls tests' => sub {
Link Here
|
| 2023 |
C4::Circulation::AddReturn( $item1->barcode, $branchcode ); |
2023 |
C4::Circulation::AddReturn( $item1->barcode, $branchcode ); |
| 2024 |
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall if no items are checked out" ); |
2024 |
is( $item1->can_be_recalled({ patron => $patron1 }), 0, "Can't recall if no items are checked out" ); |
| 2025 |
|
2025 |
|
| 2026 |
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode ); |
2026 |
C4::Circulation::AddIssue( $patron2, $item1->barcode ); |
| 2027 |
is( $item1->can_be_recalled({ patron => $patron1 }), 1, "Can recall item" ); |
2027 |
is( $item1->can_be_recalled({ patron => $patron1 }), 1, "Can recall item" ); |
| 2028 |
|
2028 |
|
| 2029 |
$recall1 = Koha::Recall->new( |
2029 |
$recall1 = Koha::Recall->new( |
|
Lines 2168-2174
subtest 'has_pending_recall() tests' => sub {
Link Here
|
| 2168 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); |
2168 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); |
| 2169 |
t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); |
2169 |
t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); |
| 2170 |
|
2170 |
|
| 2171 |
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); |
2171 |
C4::Circulation::AddIssue( $patron, $item->barcode ); |
| 2172 |
|
2172 |
|
| 2173 |
my ($recall) = Koha::Recalls->add_recall({ biblio => $item->biblio, item => $item, patron => $patron }); |
2173 |
my ($recall) = Koha::Recalls->add_recall({ biblio => $item->biblio, item => $item, patron => $patron }); |
| 2174 |
|
2174 |
|