Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 2; |
22 |
use Test::More tests => 3; |
23 |
|
23 |
|
24 |
use C4::Reserves; |
24 |
use C4::Reserves; |
25 |
|
25 |
|
Lines 80-84
subtest 'subscriptions' => sub {
Link Here
|
80 |
is( $subscriptions->count, 2, 'Koha::Biblio->subscriptions should return the correct number of subscriptions'); |
80 |
is( $subscriptions->count, 2, 'Koha::Biblio->subscriptions should return the correct number of subscriptions'); |
81 |
}; |
81 |
}; |
82 |
|
82 |
|
|
|
83 |
subtest 'waiting_or_in_transit' => sub { |
84 |
plan tests => 4; |
85 |
my $biblio = $builder->build( { source => 'Biblio' } ); |
86 |
my $item = $builder->build({ |
87 |
source => 'Item', |
88 |
value => { |
89 |
biblionumber => $biblio->{biblionumber} |
90 |
} |
91 |
}); |
92 |
my $reserve = $builder->build({ |
93 |
source => 'Reserve', |
94 |
value => { |
95 |
biblionumber => $biblio->{biblionumber}, |
96 |
found => undef |
97 |
} |
98 |
}); |
99 |
|
100 |
$reserve = Koha::Holds->find($reserve->{reserve_id}); |
101 |
$biblio = Koha::Biblios->find($biblio->{biblionumber}); |
102 |
|
103 |
is($biblio->hasItemswaitingOrInTransit, 0, 'Item is neither waiting nor in transit'); |
104 |
|
105 |
$reserve->found('W')->store; |
106 |
is($biblio->hasItemswaitingOrInTransit, 1, 'Item is waiting'); |
107 |
|
108 |
$reserve->found('T')->store; |
109 |
is($biblio->hasItemswaitingOrInTransit, 1, 'Item is in transit'); |
110 |
|
111 |
my $transfer = $builder->build({ |
112 |
source => 'Branchtransfer', |
113 |
value => { |
114 |
itemnumber => $item->{itemnumber}, |
115 |
datearrived => undef |
116 |
} |
117 |
}); |
118 |
my $t = Koha::Database->new()->schema()->resultset( 'Branchtransfer' )->find($transfer->{branchtransfer_id}); |
119 |
$reserve->found(undef)->store; |
120 |
is($biblio->hasItemswaitingOrInTransit, 1, 'Item has transfer'); |
121 |
}; |
122 |
|
83 |
$schema->storage->txn_rollback; |
123 |
$schema->storage->txn_rollback; |
84 |
|
124 |
|
85 |
- |
|
|