Bugzilla – Attachment 57496 Details for
Bug 17594
Make Koha::Object->discard_changes available
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17594: Make Koha::Object->discard_changes available
Bug-17594-Make-KohaObject-discardchanges-available.patch (text/plain), 2.29 KB, created by
Kyle M Hall (khall)
on 2016-11-15 15:18:53 UTC
(
hide
)
Description:
Bug 17594: Make Koha::Object->discard_changes available
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-11-15 15:18:53 UTC
Size:
2.29 KB
patch
obsolete
>From 1da4a7b4a204033b21e8537b2988bdd43a7357ec Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 9 Nov 2016 13:20:16 +0000 >Subject: [PATCH] Bug 17594: Make Koha::Object->discard_changes available > >We need this new method to refresh an object after it has been updated. > >Test plan: > prove t/db_dependent/Koha/Object.t >should return green > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Object.pm | 2 +- > t/db_dependent/Koha/Object.t | 20 +++++++++++++++++++- > 2 files changed, 20 insertions(+), 2 deletions(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index b5e11af..a9e35ba 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -246,7 +246,7 @@ sub AUTOLOAD { > } > } > >- my @known_methods = qw( is_changed id in_storage get_column ); >+ my @known_methods = qw( is_changed id in_storage get_column discard_changes); > > Koha::Exceptions::Object::MethodNotCoveredByTests->throw( "The method $method is not covered by tests!" ) unless grep {/^$method$/} @known_methods; > >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index 4b0a1c4..9ea5e8c 100755 >--- a/t/db_dependent/Koha/Object.t >+++ b/t/db_dependent/Koha/Object.t >@@ -17,11 +17,14 @@ > > use Modern::Perl; > >-use Test::More tests => 6; >+use Test::More tests => 7; > use Test::Warn; > > use C4::Context; > use Koha::Database; >+use Koha::DateUtils qw( dt_from_string ); >+ >+use t::lib::TestBuilder; > > BEGIN { > use_ok('Koha::Object'); >@@ -89,4 +92,19 @@ subtest 'get_column' => sub { > my $patron = Koha::Patron->new({categorycode => $categorycode, branchcode => $branchcode })->store; > is( $patron->get_column('borrowernumber'), $patron->borrowernumber, 'get_column should retrieve the correct value' ); > }; >+ >+subtest 'discard_changes' => sub { >+ plan tests => 1; >+ my $builder = t::lib::TestBuilder->new; >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ $patron = Koha::Patrons->find( $patron->{borrowernumber} ); >+ $patron->dateexpiry(dt_from_string); >+ $patron->discard_changes; >+ is( >+ dt_from_string( $patron->dateexpiry ), >+ dt_from_string->truncate( to => 'day' ), >+ 'discard_changes should refresh the object' >+ ); >+}; >+ > 1; >-- >2.1.4
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 17594
:
57385
|
57484
|
57485
| 57496