Lines 140-168
subtest "FeePayment->pay tests" => sub {
Link Here
|
140 |
subtest cancel_hold => sub { |
140 |
subtest cancel_hold => sub { |
141 |
plan tests => 7; |
141 |
plan tests => 7; |
142 |
|
142 |
|
143 |
my $category = $builder->build({ source => 'Category', value => { category_type => 'A' }}); |
143 |
my $library = $builder->build_object ({ class => 'Koha::Libraries' }); |
144 |
my $branch = $builder->build({ source => 'Branch' }); |
144 |
my $patron = $builder->build_object( |
145 |
my $borrower = $builder->build({ source => 'Borrower', value =>{ |
145 |
{ |
146 |
branchcode => $branch->{branchcode}, |
146 |
class => 'Koha::Patrons', |
147 |
categorycode=>$category->{categorycode} |
147 |
value => { |
|
|
148 |
branchcode => $library->branchcode, |
149 |
} |
148 |
} |
150 |
} |
149 |
}); |
151 |
); |
150 |
t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 }); |
152 |
t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode, flags => 1 }); |
151 |
|
153 |
|
152 |
my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} }); |
|
|
153 |
my $biblio = $builder->build_sample_biblio(); |
154 |
my $item = $builder->build_sample_item({ |
154 |
my $item = $builder->build_sample_item({ |
155 |
homebranch => $branch->{branchcode}, |
155 |
library => $library->branchcode, |
156 |
holdingbranch => $branch->{branchcode}, |
|
|
157 |
biblionumber => $biblio->biblionumber, |
158 |
itype => $itype->{itemtype}, |
159 |
notforloan => 0, |
160 |
}); |
156 |
}); |
161 |
|
157 |
|
162 |
Koha::IssuingRule->new({ |
158 |
Koha::IssuingRule->new({ |
163 |
categorycode => $borrower->{categorycode}, |
159 |
categorycode => $patron->categorycode, |
164 |
itemtype => $itype->{itemtype}, |
160 |
itemtype => $item->effective_itemtype, |
165 |
branchcode => $branch->{branchcode}, |
161 |
branchcode => $library->branchcode, |
166 |
onshelfholds => 1, |
162 |
onshelfholds => 1, |
167 |
reservesallowed => 3, |
163 |
reservesallowed => 3, |
168 |
holds_per_record => 3, |
164 |
holds_per_record => 3, |
Lines 170-187
subtest cancel_hold => sub {
Link Here
|
170 |
lengthunit => 'days', |
166 |
lengthunit => 'days', |
171 |
})->store; |
167 |
})->store; |
172 |
|
168 |
|
173 |
my $reserve1 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$biblio->biblionumber,undef,undef,undef,undef,undef,undef,$item->itemnumber); |
169 |
my $reserve1 = |
174 |
is( $biblio->holds->count(), 1, "Hold was placed on bib"); |
170 |
AddReserve( $library->branchcode, $patron->borrowernumber, |
|
|
171 |
$item->biblio->biblionumber, |
172 |
undef, undef, undef, undef, undef, undef, $item->itemnumber ); |
173 |
is( $item->biblio->holds->count(), 1, "Hold was placed on bib"); |
175 |
is( $item->holds->count(),1,"Hold was placed on specific item"); |
174 |
is( $item->holds->count(),1,"Hold was placed on specific item"); |
176 |
|
175 |
|
177 |
my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} ); |
176 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); |
178 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
177 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
179 |
my $transaction = C4::SIP::ILS::Transaction::Hold->new(); |
178 |
my $transaction = C4::SIP::ILS::Transaction::Hold->new(); |
180 |
is( ref $transaction, "C4::SIP::ILS::Transaction::Hold", "New transaction created" ); |
179 |
is( ref $transaction, "C4::SIP::ILS::Transaction::Hold", "New transaction created" ); |
181 |
is( $transaction->patron( $sip_patron ), $sip_patron, "Patron assigned to transaction" ); |
180 |
is( $transaction->patron( $sip_patron ), $sip_patron, "Patron assigned to transaction" ); |
182 |
is( $transaction->item( $sip_item ), $sip_item, "Item assigned to transaction" ); |
181 |
is( $transaction->item( $sip_item ), $sip_item, "Item assigned to transaction" ); |
183 |
my $hold = $transaction->drop_hold(); |
182 |
my $hold = $transaction->drop_hold(); |
184 |
is( $biblio->holds->count(), 0, "Bib has 0 holds remaining"); |
183 |
is( $item->biblio->holds->count(), 0, "Bib has 0 holds remaining"); |
185 |
is( $item->holds->count(), 0, "Item has 0 holds remaining"); |
184 |
is( $item->holds->count(), 0, "Item has 0 holds remaining"); |
186 |
}; |
185 |
}; |
187 |
|
186 |
|
188 |
- |
|
|