|
Lines 463-472
subtest "delete" => sub {
Link Here
|
| 463 |
plan tests => 11; |
463 |
plan tests => 11; |
| 464 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
464 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
| 465 |
t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer' ); |
465 |
t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer' ); |
| 466 |
Koha::Virtualshelves->search({})->delete; |
466 |
Koha::Virtualshelves->delete; |
| 467 |
my $userenv = C4::Context->userenv(); |
467 |
|
|
|
468 |
my $staff_patron = $builder->build_object({ class => 'Koha::Patrons' }); |
| 469 |
t::lib::Mocks::mock_userenv({ patron => $staff_patron }); |
| 470 |
|
| 468 |
my $patron = $builder->build( { source => 'Borrower' } ); |
471 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 469 |
my $patron_for_sharing = (ref($userenv) eq 'HASH' ) ? $userenv->{'number'} : 0; |
472 |
my $patron_for_sharing = $staff_patron->borrowernumber; |
| 470 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
473 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 471 |
my $hold = $builder->build( |
474 |
my $hold = $builder->build( |
| 472 |
{ source => 'Reserve', |
475 |
{ source => 'Reserve', |
|
Lines 477-495
subtest "delete" => sub {
Link Here
|
| 477 |
my $private_list = Koha::Virtualshelf->new({ |
480 |
my $private_list = Koha::Virtualshelf->new({ |
| 478 |
shelfname => "private", |
481 |
shelfname => "private", |
| 479 |
owner => $patron->{borrowernumber}, |
482 |
owner => $patron->{borrowernumber}, |
| 480 |
category => 1 |
483 |
public => 0, |
| 481 |
} |
484 |
} |
| 482 |
)->store; |
485 |
)->store; |
| 483 |
my $public_list = Koha::Virtualshelf->new({ |
486 |
my $public_list = Koha::Virtualshelf->new({ |
| 484 |
shelfname => "public", |
487 |
shelfname => "public", |
| 485 |
owner => $patron->{borrowernumber}, |
488 |
owner => $patron->{borrowernumber}, |
| 486 |
category => 2 |
489 |
public => 1, |
| 487 |
} |
490 |
} |
| 488 |
)->store; |
491 |
)->store; |
| 489 |
my $list_to_share = Koha::Virtualshelf->new({ |
492 |
my $list_to_share = Koha::Virtualshelf->new({ |
| 490 |
shelfname => "shared", |
493 |
shelfname => "shared", |
| 491 |
owner => $patron->{borrowernumber}, |
494 |
owner => $patron->{borrowernumber}, |
| 492 |
category => 1 |
495 |
public => 0, |
| 493 |
} |
496 |
} |
| 494 |
)->store; |
497 |
)->store; |
| 495 |
|
498 |
|
|
Lines 520-538
subtest "delete" => sub {
Link Here
|
| 520 |
my $private_list2 = Koha::Virtualshelf->new({ |
523 |
my $private_list2 = Koha::Virtualshelf->new({ |
| 521 |
shelfname => "private", |
524 |
shelfname => "private", |
| 522 |
owner => $patron2->{borrowernumber}, |
525 |
owner => $patron2->{borrowernumber}, |
| 523 |
category => 1 |
526 |
public => 0, |
| 524 |
} |
527 |
} |
| 525 |
)->store; |
528 |
)->store; |
| 526 |
my $public_list2 = Koha::Virtualshelf->new({ |
529 |
my $public_list2 = Koha::Virtualshelf->new({ |
| 527 |
shelfname => "public", |
530 |
shelfname => "public", |
| 528 |
owner => $patron2->{borrowernumber}, |
531 |
owner => $patron2->{borrowernumber}, |
| 529 |
category => 2 |
532 |
public => 1, |
| 530 |
} |
533 |
} |
| 531 |
)->store; |
534 |
)->store; |
| 532 |
my $list_to_share2 = Koha::Virtualshelf->new({ |
535 |
my $list_to_share2 = Koha::Virtualshelf->new({ |
| 533 |
shelfname => "shared", |
536 |
shelfname => "shared", |
| 534 |
owner => $patron2->{borrowernumber}, |
537 |
owner => $patron2->{borrowernumber}, |
| 535 |
category => 1 |
538 |
public => 0, |
| 536 |
} |
539 |
} |
| 537 |
)->store; |
540 |
)->store; |
| 538 |
|
541 |
|