|
Lines 20-26
Link Here
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use utf8; |
21 |
use utf8; |
| 22 |
|
22 |
|
| 23 |
use Test::More tests => 25; |
23 |
use Test::More tests => 26; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
| 25 |
use Test::MockModule; |
25 |
use Test::MockModule; |
| 26 |
|
26 |
|
|
Lines 32-37
use Koha::Items;
Link Here
|
| 32 |
use Koha::Database; |
32 |
use Koha::Database; |
| 33 |
use Koha::DateUtils qw( dt_from_string ); |
33 |
use Koha::DateUtils qw( dt_from_string ); |
| 34 |
use Koha::Old::Items; |
34 |
use Koha::Old::Items; |
|
|
35 |
use Koha::Recalls; |
| 35 |
|
36 |
|
| 36 |
use List::MoreUtils qw(all); |
37 |
use List::MoreUtils qw(all); |
| 37 |
|
38 |
|
|
Lines 1722-1724
subtest 'item_group() tests' => sub {
Link Here
|
| 1722 |
|
1723 |
|
| 1723 |
$schema->storage->txn_rollback; |
1724 |
$schema->storage->txn_rollback; |
| 1724 |
}; |
1725 |
}; |
| 1725 |
- |
1726 |
|
|
|
1727 |
subtest 'has_pending_recall() tests' => sub { |
| 1728 |
|
| 1729 |
plan tests => 2; |
| 1730 |
|
| 1731 |
$schema->storage->txn_begin; |
| 1732 |
|
| 1733 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 1734 |
my $item = $builder->build_sample_item; |
| 1735 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 1736 |
|
| 1737 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); |
| 1738 |
t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); |
| 1739 |
|
| 1740 |
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode ); |
| 1741 |
|
| 1742 |
my ($recall) = Koha::Recalls->add_recall({ biblio => $item->biblio, item => $item, patron => $patron }); |
| 1743 |
|
| 1744 |
ok( !$item->has_pending_recall, 'The item has no pending recalls' ); |
| 1745 |
|
| 1746 |
$recall->status('waiting')->store; |
| 1747 |
|
| 1748 |
ok( $item->has_pending_recall, 'The item has a pending recall' ); |
| 1749 |
|
| 1750 |
$schema->storage->txn_rollback; |
| 1751 |
}; |