Lines 318-331
subtest 'renew_account' => sub {
Link Here
|
318 |
}; |
318 |
}; |
319 |
|
319 |
|
320 |
subtest "move_to_deleted" => sub { |
320 |
subtest "move_to_deleted" => sub { |
321 |
plan tests => 2; |
321 |
plan tests => 3; |
322 |
my $patron = $builder->build( { source => 'Borrower' } ); |
322 |
my $originally_updated_on = '2016-01-01 12:12:12'; |
|
|
323 |
my $patron = $builder->build( { source => 'Borrower',value => { updated_on => $originally_updated_on } } ); |
323 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
324 |
my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); |
324 |
is( ref( $retrieved_patron->move_to_deleted ), 'Koha::Schema::Result::Deletedborrower', 'Koha::Patron->move_to_deleted should return the Deleted patron' ) |
325 |
is( ref( $retrieved_patron->move_to_deleted ), 'Koha::Schema::Result::Deletedborrower', 'Koha::Patron->move_to_deleted should return the Deleted patron' ) |
325 |
; # FIXME This should be Koha::Deleted::Patron |
326 |
; # FIXME This should be Koha::Deleted::Patron |
326 |
my $deleted_patron = $schema->resultset('Deletedborrower') |
327 |
my $deleted_patron = $schema->resultset('Deletedborrower') |
327 |
->search( { borrowernumber => $patron->{borrowernumber} }, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } ) |
328 |
->search( { borrowernumber => $patron->{borrowernumber} }, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } ) |
328 |
->next; |
329 |
->next; |
|
|
330 |
isnt( $deleted_patron->{updated_on}, $retrieved_patron->{updated_on}, 'Koha::Patron->move_to_deleted should have correctly updated the updated_on column'); |
331 |
$deleted_patron->{updated_on} = $originally_updated_on; #reset for simplicity in comparing all other fields |
329 |
is_deeply( $deleted_patron, $patron, 'Koha::Patron->move_to_deleted should have correctly moved the patron to the deleted table' ); |
332 |
is_deeply( $deleted_patron, $patron, 'Koha::Patron->move_to_deleted should have correctly moved the patron to the deleted table' ); |
330 |
$retrieved_patron->delete( $patron->{borrowernumber} ); # Cleanup |
333 |
$retrieved_patron->delete( $patron->{borrowernumber} ); # Cleanup |
331 |
}; |
334 |
}; |
332 |
- |
|
|