|
Lines 19-28
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 8; |
22 |
use Test::More tests => 9; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
|
24 |
|
| 25 |
use C4::Circulation; |
25 |
use C4::Circulation; |
|
|
26 |
|
| 27 |
use C4::Members; |
| 28 |
|
| 26 |
use Koha::Patron; |
29 |
use Koha::Patron; |
| 27 |
use Koha::Patrons; |
30 |
use Koha::Patrons; |
| 28 |
use Koha::Database; |
31 |
use Koha::Database; |
|
Lines 207-212
subtest 'renew_account' => sub {
Link Here
|
| 207 |
$retrieved_patron->delete; |
210 |
$retrieved_patron->delete; |
| 208 |
}; |
211 |
}; |
| 209 |
|
212 |
|
|
|
213 |
subtest "move_to_deleted" => sub { |
| 214 |
plan tests => 2; |
| 215 |
my $patron = $builder->build( { source => 'Borrower' } ); |
| 216 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
| 217 |
is( ref( $retrieved_patron->move_to_deleted ), 'Koha::Schema::Result::Deletedborrower', 'Koha::Patron->move_to_deleted should return the Deleted patron' ) |
| 218 |
; # FIXME This should be Koha::Deleted::Patron |
| 219 |
my $deleted_patron = $schema->resultset('Deletedborrower') |
| 220 |
->search( { borrowernumber => $patron->{borrowernumber} }, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } ) |
| 221 |
->next; |
| 222 |
is_deeply( $deleted_patron, $patron, 'Koha::Patron->move_to_deleted should have correctly moved the patron to the deleted table' ); |
| 223 |
C4::Members::DelMember( $patron->{borrowernumber} ); # Cleanup |
| 224 |
}; |
| 225 |
|
| 210 |
$retrieved_patron_1->delete; |
226 |
$retrieved_patron_1->delete; |
| 211 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
227 |
is( Koha::Patrons->search->count, $nb_of_patrons + 1, 'Delete should have deleted the patron' ); |
| 212 |
|
228 |
|