Lines 466-472
subtest "move_to_deleted" => sub {
Link Here
|
466 |
}; |
466 |
}; |
467 |
|
467 |
|
468 |
subtest "delete" => sub { |
468 |
subtest "delete" => sub { |
469 |
plan tests => 6; |
469 |
plan tests => 7; |
470 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
470 |
t::lib::Mocks::mock_preference( 'BorrowersLog', 1 ); |
471 |
my $patron = $builder->build( { source => 'Borrower' } ); |
471 |
my $patron = $builder->build( { source => 'Borrower' } ); |
472 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
472 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
Lines 480-485
subtest "delete" => sub {
Link Here
|
480 |
value => { owner => $patron->{borrowernumber} } |
480 |
value => { owner => $patron->{borrowernumber} } |
481 |
} |
481 |
} |
482 |
); |
482 |
); |
|
|
483 |
my $modification = $builder->build_object({ class => 'Koha::Patron::Modifications', value => { borrowernumber => $patron->{borrowernumber} } }); |
483 |
|
484 |
|
484 |
my $deleted = $retrieved_patron->delete; |
485 |
my $deleted = $retrieved_patron->delete; |
485 |
is( ref($deleted), 'Koha::Patron', 'Koha::Patron->delete should return the deleted patron object if the patron has been correctly deleted' ); |
486 |
is( ref($deleted), 'Koha::Patron', 'Koha::Patron->delete should return the deleted patron object if the patron has been correctly deleted' ); |
Lines 492-497
subtest "delete" => sub {
Link Here
|
492 |
|
493 |
|
493 |
is( Koha::Virtualshelves->search( { owner => $patron->{borrowernumber} } )->count, 0, q|Koha::Patron->delete should have deleted patron's lists| ); |
494 |
is( Koha::Virtualshelves->search( { owner => $patron->{borrowernumber} } )->count, 0, q|Koha::Patron->delete should have deleted patron's lists| ); |
494 |
|
495 |
|
|
|
496 |
is( Koha::Patron::Modifications->search( { borrowernumber => $patron->{borrowernumber} } )->count, 0, q|Koha::Patron->delete should have deleted patron's modifications| ); |
497 |
|
495 |
my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'DELETE', object => $retrieved_patron->borrowernumber } )->count; |
498 |
my $number_of_logs = $schema->resultset('ActionLog')->search( { module => 'MEMBERS', action => 'DELETE', object => $retrieved_patron->borrowernumber } )->count; |
496 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->delete should have logged' ); |
499 |
is( $number_of_logs, 1, 'With BorrowerLogs, Koha::Patron->delete should have logged' ); |
497 |
}; |
500 |
}; |
498 |
- |
|
|