|
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 => 12; |
7 |
use Test::More tests => 13; |
| 8 |
|
8 |
|
| 9 |
use Koha::Database; |
9 |
use Koha::Database; |
| 10 |
use t::lib::TestBuilder; |
10 |
use t::lib::TestBuilder; |
|
Lines 212-218
subtest cancel_hold => sub {
Link Here
|
| 212 |
subtest do_hold => sub { |
212 |
subtest do_hold => sub { |
| 213 |
plan tests => 8; |
213 |
plan tests => 8; |
| 214 |
|
214 |
|
| 215 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
215 |
my $library = $builder->build_object( |
|
|
216 |
{ |
| 217 |
class => 'Koha::Libraries', |
| 218 |
value => { |
| 219 |
pickup_location => 1 |
| 220 |
} |
| 221 |
} |
| 222 |
); |
| 216 |
my $patron_1 = $builder->build_object( |
223 |
my $patron_1 = $builder->build_object( |
| 217 |
{ |
224 |
{ |
| 218 |
class => 'Koha::Patrons', |
225 |
class => 'Koha::Patrons', |
|
Lines 271-276
subtest do_hold => sub {
Link Here
|
| 271 |
is( $THE_hold->branchcode, $patron_2->branchcode, 'Hold placed from SIP should have the branchcode set' ); |
278 |
is( $THE_hold->branchcode, $patron_2->branchcode, 'Hold placed from SIP should have the branchcode set' ); |
| 272 |
}; |
279 |
}; |
| 273 |
|
280 |
|
|
|
281 |
subtest "Placing holds via SIP check CanItemBeReserved" => sub { |
| 282 |
plan tests => 4; |
| 283 |
|
| 284 |
my $library = $builder->build_object( |
| 285 |
{ |
| 286 |
class => 'Koha::Libraries', |
| 287 |
value => { |
| 288 |
pickup_location => 0 |
| 289 |
} |
| 290 |
} |
| 291 |
); |
| 292 |
my $patron_1 = $builder->build_object( |
| 293 |
{ |
| 294 |
class => 'Koha::Patrons', |
| 295 |
value => { |
| 296 |
branchcode => $library->branchcode, |
| 297 |
} |
| 298 |
} |
| 299 |
); |
| 300 |
my $patron_2 = $builder->build_object( |
| 301 |
{ |
| 302 |
class => 'Koha::Patrons', |
| 303 |
value => { |
| 304 |
branchcode => $library->branchcode, |
| 305 |
categorycode => $patron_1->categorycode, |
| 306 |
} |
| 307 |
} |
| 308 |
); |
| 309 |
|
| 310 |
t::lib::Mocks::mock_userenv( |
| 311 |
{ branchcode => $library->branchcode, flags => 1 } ); |
| 312 |
|
| 313 |
my $item = $builder->build_sample_item( |
| 314 |
{ |
| 315 |
library => $library->branchcode, |
| 316 |
} |
| 317 |
); |
| 318 |
|
| 319 |
my $sip_patron = C4::SIP::ILS::Patron->new( $patron_2->cardnumber ); |
| 320 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
| 321 |
my $transaction = C4::SIP::ILS::Transaction::Hold->new(); |
| 322 |
is( |
| 323 |
ref $transaction, |
| 324 |
"C4::SIP::ILS::Transaction::Hold", |
| 325 |
"New transaction created" |
| 326 |
); |
| 327 |
is( $transaction->patron($sip_patron), |
| 328 |
$sip_patron, "Patron assigned to transaction" ); |
| 329 |
is( $transaction->item($sip_item), |
| 330 |
$sip_item, "Item assigned to transaction" ); |
| 331 |
my $hold = $transaction->do_hold(); |
| 332 |
|
| 333 |
is( $transaction->ok, 0, "Hold was not allowed" ); |
| 334 |
}; |
| 335 |
|
| 274 |
subtest do_checkin => sub { |
336 |
subtest do_checkin => sub { |
| 275 |
plan tests => 12; |
337 |
plan tests => 12; |
| 276 |
|
338 |
|
| 277 |
- |
|
|