|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 8; |
22 |
use Test::More tests => 9; |
| 23 |
|
23 |
|
| 24 |
use C4::Circulation; |
24 |
use C4::Circulation; |
| 25 |
use Koha::Item; |
25 |
use Koha::Item; |
|
Lines 31-37
use t::lib::TestBuilder;
Link Here
|
| 31 |
my $schema = Koha::Database->new->schema; |
31 |
my $schema = Koha::Database->new->schema; |
| 32 |
$schema->storage->txn_begin; |
32 |
$schema->storage->txn_begin; |
| 33 |
|
33 |
|
| 34 |
my $builder = t::lib::TestBuilder->new; |
34 |
our $builder = t::lib::TestBuilder->new; |
| 35 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
35 |
my $biblioitem = $builder->build( { source => 'Biblioitem' } ); |
| 36 |
my $library = $builder->build( { source => 'Branch' } ); |
36 |
my $library = $builder->build( { source => 'Branch' } ); |
| 37 |
my $nb_of_items = Koha::Items->search->count; |
37 |
my $nb_of_items = Koha::Items->search->count; |
|
Lines 121-125
subtest 'checkout' => sub {
Link Here
|
| 121 |
$retrieved_item_1->delete; |
121 |
$retrieved_item_1->delete; |
| 122 |
is( Koha::Items->search->count, $nb_of_items + 1, 'Delete should have deleted the item' ); |
122 |
is( Koha::Items->search->count, $nb_of_items + 1, 'Delete should have deleted the item' ); |
| 123 |
|
123 |
|
|
|
124 |
subtest 'is_waiting_or_transit' => sub { |
| 125 |
plan tests => 3; |
| 126 |
|
| 127 |
my $hold = $builder->build_object({ class => 'Koha::Holds', value => { found => 'W' } }); |
| 128 |
is( Koha::Items->find($hold->itemnumber)->is_waiting_or_transit, 1, |
| 129 |
'Item is waiting' ); |
| 130 |
$hold->found('T')->store; |
| 131 |
is( Koha::Items->find($hold->itemnumber)->is_waiting_or_transit, 1, |
| 132 |
'Item has transit hold' ); |
| 133 |
$hold->found(undef)->store; |
| 134 |
is( Koha::Items->find($hold->itemnumber)->is_waiting_or_transit, q{}, |
| 135 |
'Item should be available' ); |
| 136 |
}; |
| 137 |
|
| 124 |
$schema->storage->txn_rollback; |
138 |
$schema->storage->txn_rollback; |
| 125 |
|
139 |
|
| 126 |
- |
|
|