Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 4; |
22 |
use Test::More tests => 5; |
23 |
use Test::Warn; |
23 |
use Test::Warn; |
24 |
|
24 |
|
25 |
use C4::Reserves; |
25 |
use C4::Reserves; |
Lines 368-373
subtest 'cancel all with reason' => sub {
Link Here
|
368 |
$message->delete; |
368 |
$message->delete; |
369 |
}; |
369 |
}; |
370 |
|
370 |
|
|
|
371 |
subtest 'Desks' => sub { |
372 |
plan tests => 5; |
373 |
my $library = $builder->build_object( { class => 'Koha::Libraries' } ); |
374 |
|
375 |
my $desk = Koha::Desk->new({ |
376 |
desk_name => 'my_desk_name_for_test', |
377 |
branchcode => $library->branchcode , |
378 |
})->store; |
379 |
ok($desk, "Desk created"); |
380 |
my $item = $builder->build_sample_item({ library => $library->branchcode }); |
381 |
my $manager = $builder->build_object( { class => "Koha::Patrons" } ); |
382 |
t::lib::Mocks::mock_userenv( { patron => $manager, branchcode => $manager->branchcode } ); |
383 |
|
384 |
my $patron = $builder->build_object( |
385 |
{ |
386 |
class => 'Koha::Patrons', |
387 |
value => { branchcode => $library->branchcode, } |
388 |
} |
389 |
); |
390 |
|
391 |
my $reserve_id = C4::Reserves::AddReserve( |
392 |
{ |
393 |
branchcode => $library->branchcode, |
394 |
borrowernumber => $patron->borrowernumber, |
395 |
biblionumber => $item->biblionumber, |
396 |
priority => 1, |
397 |
itemnumber => $item->itemnumber, |
398 |
} |
399 |
); |
400 |
|
401 |
my $hold = Koha::Holds->find($reserve_id); |
402 |
|
403 |
ok($reserve_id, "Hold created"); |
404 |
ok($hold, "Hold found"); |
405 |
$hold->set_waiting($desk->desk_id); |
406 |
is($hold->found, 'W', 'Hold is waiting with correct status set'); |
407 |
is($hold->desk_id, $desk->desk_id, 'Hold is attach to its desk'); |
408 |
|
409 |
}; |
410 |
|
371 |
$schema->storage->txn_rollback; |
411 |
$schema->storage->txn_rollback; |
372 |
|
412 |
|
373 |
1; |
413 |
1; |
374 |
- |
|
|