|
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 => 5; |
7 |
use Test::More tests => 6; |
| 8 |
|
8 |
|
| 9 |
use Koha::Database; |
9 |
use Koha::Database; |
| 10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
|
Lines 13-18
use C4::SIP::ILS::Patron;
Link Here
|
| 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::FeePayment; |
15 |
use C4::SIP::ILS::Transaction::FeePayment; |
|
|
16 |
use C4::SIP::ILS::Transaction::Hold; |
| 16 |
|
17 |
|
| 17 |
use C4::Reserves; |
18 |
use C4::Reserves; |
| 18 |
use Koha::IssuingRules; |
19 |
use Koha::IssuingRules; |
|
Lines 136-139
subtest "FeePayment->pay tests" => sub {
Link Here
|
| 136 |
is( $credit->payment_type, 'SIP00', "Payment type was set correctly" ); |
137 |
is( $credit->payment_type, 'SIP00', "Payment type was set correctly" ); |
| 137 |
}; |
138 |
}; |
| 138 |
|
139 |
|
|
|
140 |
subtest cancel_hold => sub { |
| 141 |
plan tests => 7; |
| 142 |
|
| 143 |
my $category = $builder->build({ source => 'Category', value => { category_type => 'A' }}); |
| 144 |
my $branch = $builder->build({ source => 'Branch' }); |
| 145 |
my $borrower = $builder->build({ source => 'Borrower', value =>{ |
| 146 |
branchcode => $branch->{branchcode}, |
| 147 |
categorycode=>$category->{categorycode} |
| 148 |
} |
| 149 |
}); |
| 150 |
t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 }); |
| 151 |
|
| 152 |
my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} }); |
| 153 |
my $biblio = $builder->build_sample_biblio(); |
| 154 |
my $item = $builder->build_sample_item({ |
| 155 |
homebranch => $branch->{branchcode}, |
| 156 |
holdingbranch => $branch->{branchcode}, |
| 157 |
biblionumber => $biblio->biblionumber, |
| 158 |
itype => $itype->{itemtype}, |
| 159 |
notforloan => 0, |
| 160 |
}); |
| 161 |
|
| 162 |
Koha::IssuingRule->new({ |
| 163 |
categorycode => $borrower->{categorycode}, |
| 164 |
itemtype => $itype->{itemtype}, |
| 165 |
branchcode => $branch->{branchcode}, |
| 166 |
onshelfholds => 1, |
| 167 |
reservesallowed => 3, |
| 168 |
holds_per_record => 3, |
| 169 |
issuelength => 5, |
| 170 |
lengthunit => 'days', |
| 171 |
})->store; |
| 172 |
|
| 173 |
my $reserve1 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$biblio->biblionumber,undef,undef,undef,undef,undef,undef,$item->itemnumber); |
| 174 |
is( $biblio->holds->count(), 1, "Hold was placed on bib"); |
| 175 |
is( $item->holds->count(),1,"Hold was placed on specific item"); |
| 176 |
|
| 177 |
my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} ); |
| 178 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
| 179 |
my $transaction = C4::SIP::ILS::Transaction::Hold->new(); |
| 180 |
is( ref $transaction, "C4::SIP::ILS::Transaction::Hold", "New transaction created" ); |
| 181 |
is( $transaction->patron( $sip_patron ), $sip_patron, "Patron assigned to transaction" ); |
| 182 |
is( $transaction->item( $sip_item ), $sip_item, "Item assigned to transaction" ); |
| 183 |
my $hold = $transaction->drop_hold(); |
| 184 |
is( $biblio->holds->count(), 0, "Bib has 0 holds remaining"); |
| 185 |
is( $item->holds->count(), 0, "Item has 0 holds remaining"); |
| 186 |
}; |
| 187 |
|
| 139 |
$schema->storage->txn_rollback; |
188 |
$schema->storage->txn_rollback; |
| 140 |
- |
|
|