Bugzilla – Attachment 59573 Details for
Bug 17782
Patron updated_on field should be set to current timestamp when borrower is deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17782: Try to fix tests
Bug-17782-Try-to-fix-tests.patch (text/plain), 2.83 KB, created by
Jonathan Druart
on 2017-01-26 11:27:19 UTC
(
hide
)
Description:
Bug 17782: Try to fix tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-26 11:27:19 UTC
Size:
2.83 KB
patch
obsolete
>From 72d8d4794c50f7f47442455ba2bb73526ee888fb Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 26 Jan 2017 12:26:17 +0100 >Subject: [PATCH] Bug 17782: Try to fix tests > >Previous code was wrong, $retrieved_patron->{updated_on} is always >undef, $retrieved_patron is a Koha::Object >--- > t/db_dependent/Koha/Patrons.t | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t >index f666507..bc09888 100644 >--- a/t/db_dependent/Koha/Patrons.t >+++ b/t/db_dependent/Koha/Patrons.t >@@ -318,18 +318,20 @@ subtest 'renew_account' => sub { > }; > > subtest "move_to_deleted" => sub { >- plan tests => 3; >+ plan tests => 5; > my $originally_updated_on = '2016-01-01 12:12:12'; > my $patron = $builder->build( { source => 'Borrower',value => { updated_on => $originally_updated_on } } ); > my $retrieved_patron = Koha::Patrons->find( $patron->{borrowernumber} ); >- is( ref( $retrieved_patron->move_to_deleted ), 'Koha::Schema::Result::Deletedborrower', 'Koha::Patron->move_to_deleted should return the Deleted patron' ) >+ my $deleted_patron = $retrieved_patron->move_to_deleted; >+ is( ref( $deleted_patron ), 'Koha::Schema::Result::Deletedborrower', 'Koha::Patron->move_to_deleted should return the Deleted patron' ) > ; # FIXME This should be Koha::Deleted::Patron >- my $deleted_patron = $schema->resultset('Deletedborrower') >- ->search( { borrowernumber => $patron->{borrowernumber} }, { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } ) >- ->next; >- isnt( $deleted_patron->{updated_on}, $retrieved_patron->{updated_on}, 'Koha::Patron->move_to_deleted should have correctly updated the updated_on column'); >- $deleted_patron->{updated_on} = $originally_updated_on; #reset for simplicity in comparing all other fields >- is_deeply( $deleted_patron, $patron, 'Koha::Patron->move_to_deleted should have correctly moved the patron to the deleted table' ); >+ >+ #$deleted_patron->discard_changes; # This does not work >+ ok( $deleted_patron->updated_on, 'The ->updated_on method should return something' ); >+ is( dt_from_string($deleted_patron->updated_on)->truncate( to => 'day' ), dt_from_string->truncate( to => 'day' ), 'The updated_on value for the deleted patron should be today' ); >+ isnt( $deleted_patron->updated_on, $retrieved_patron->updated_on, 'Koha::Patron->move_to_deleted should have correctly updated the updated_on column'); >+ $deleted_patron->updated_on($originally_updated_on); #reset for simplicity in comparing all other fields >+ is_deeply( { $deleted_patron->get_columns }, $patron, 'Koha::Patron->move_to_deleted should have correctly moved the patron to the deleted table' ); > $retrieved_patron->delete( $patron->{borrowernumber} ); # Cleanup > }; > >-- >2.9.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17782
:
58203
|
58890
|
58913
|
59558
|
59573
|
59583
|
59605
|
59606
|
59607
|
60047