Lines 19-26
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 5; |
22 |
use Test::More tests => 6; |
23 |
|
23 |
|
|
|
24 |
use C4::Members; |
24 |
use Koha::Patron; |
25 |
use Koha::Patron; |
25 |
use Koha::Patrons; |
26 |
use Koha::Patrons; |
26 |
use Koha::Database; |
27 |
use Koha::Database; |
Lines 98-103
subtest 'siblings' => sub {
Link Here
|
98 |
$retrieved_guarantee_1->delete; |
99 |
$retrieved_guarantee_1->delete; |
99 |
}; |
100 |
}; |
100 |
|
101 |
|
|
|
102 |
subtest "move_to_deleted" => sub { |
103 |
plan tests => 2; |
104 |
my $patron = $builder->build( { source => 'Borrower' } ); |
105 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
106 |
is( ref( $retrieved_patron->move_to_deleted ), 'Koha::Schema::Result::Deletedborrower', 'Koha::Patron->move_to_deleted should return the Deleted patron' ) |
107 |
; # FIXME This should be Koha::Deleted::Patron |
108 |
my $deleted_patron = $schema->resultset('Deletedborrower') |
109 |
->search( { borrowernumber => $patron->{borrowernumber} }, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } ) |
110 |
->next; |
111 |
is_deeply( $deleted_patron, $patron, 'Koha::Patron->move_to_deleted should have correctly moved the patron to the deleted table' ); |
112 |
C4::Members::DelMember( $patron->{borrowernumber} ); # Cleanup |
113 |
}; |
114 |
|
101 |
$retrieved_patron_1->delete; |
115 |
$retrieved_patron_1->delete; |
102 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
116 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
103 |
|
117 |
|