Lines 4-10
Link Here
|
4 |
# Current state is very rudimentary. Please help to extend it! |
4 |
# Current state is very rudimentary. Please help to extend it! |
5 |
|
5 |
|
6 |
use Modern::Perl; |
6 |
use Modern::Perl; |
7 |
use Test::More tests => 4; |
7 |
use Test::More tests => 5; |
8 |
|
8 |
|
9 |
use Koha::Database; |
9 |
use Koha::Database; |
10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
Lines 12-17
use t::lib::Mocks;
Link Here
|
12 |
use C4::SIP::ILS::Patron; |
12 |
use C4::SIP::ILS::Patron; |
13 |
use C4::SIP::ILS::Transaction::RenewAll; |
13 |
use C4::SIP::ILS::Transaction::RenewAll; |
14 |
use C4::SIP::ILS::Transaction::Checkout; |
14 |
use C4::SIP::ILS::Transaction::Checkout; |
|
|
15 |
use C4::SIP::ILS::Transaction::Hold; |
15 |
|
16 |
|
16 |
use C4::Reserves; |
17 |
use C4::Reserves; |
17 |
use Koha::IssuingRules; |
18 |
use Koha::IssuingRules; |
Lines 95-98
subtest fill_holds_at_checkout => sub {
Link Here
|
95 |
$transaction = C4::SIP::ILS::Transaction::Checkout->new(); |
96 |
$transaction = C4::SIP::ILS::Transaction::Checkout->new(); |
96 |
is( $sip_item->{barcode}, $item1->{barcode}, "Item assigned to transaction" ); |
97 |
is( $sip_item->{barcode}, $item1->{barcode}, "Item assigned to transaction" ); |
97 |
}; |
98 |
}; |
|
|
99 |
|
100 |
subtest cancel_hold => sub { |
101 |
plan tests => 7; |
102 |
|
103 |
my $library = $builder->build_object ({ class => 'Koha::Libraries' }); |
104 |
my $patron = $builder->build_object( |
105 |
{ |
106 |
class => 'Koha::Patrons', |
107 |
value => { |
108 |
branchcode => $library->branchcode, |
109 |
} |
110 |
} |
111 |
); |
112 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode, flags => 1 }); |
113 |
|
114 |
my $item = $builder->build_sample_item({ |
115 |
library => $library->branchcode, |
116 |
}); |
117 |
|
118 |
Koha::IssuingRule->new({ |
119 |
categorycode => $patron->categorycode, |
120 |
itemtype => $item->effective_itemtype, |
121 |
branchcode => $library->branchcode, |
122 |
onshelfholds => 1, |
123 |
reservesallowed => 3, |
124 |
holds_per_record => 3, |
125 |
issuelength => 5, |
126 |
lengthunit => 'days', |
127 |
})->store; |
128 |
|
129 |
my $reserve1 = |
130 |
AddReserve( $library->branchcode, $patron->borrowernumber, |
131 |
$item->biblio->biblionumber, |
132 |
undef, undef, undef, undef, undef, undef, $item->itemnumber ); |
133 |
is( $item->biblio->holds->count(), 1, "Hold was placed on bib"); |
134 |
is( Koha::Holds->search({itemnumber=>$item->itemnumber})->count() ,1,"Hold was placed on specific item"); |
135 |
|
136 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
137 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
138 |
my $transaction = C4::SIP::ILS::Transaction::Hold->new(); |
139 |
is( ref $transaction, "C4::SIP::ILS::Transaction::Hold", "New transaction created" ); |
140 |
is( $transaction->patron( $sip_patron ), $sip_patron, "Patron assigned to transaction" ); |
141 |
is( $transaction->item( $sip_item ), $sip_item, "Item assigned to transaction" ); |
142 |
my $hold = $transaction->drop_hold(); |
143 |
is( $item->biblio->holds->count(), 0, "Bib has 0 holds remaining"); |
144 |
is( Koha::Holds->search({itemnumber=>$item->itemnumber})->count(), 0, "Item has 0 holds remaining"); |
145 |
}; |
146 |
|
98 |
$schema->storage->txn_rollback; |
147 |
$schema->storage->txn_rollback; |
99 |
- |
|
|