Bugzilla – Attachment 56147 Details for
Bug 17091
Add AUTOLOAD to Koha::Objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects
Bug-17091-In-a-first-phase-restrict-the-usage-of-A.patch (text/plain), 2.12 KB, created by
Kyle M Hall (khall)
on 2016-10-11 09:14:39 UTC
(
hide
)
Description:
Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-10-11 09:14:39 UTC
Size:
2.12 KB
patch
obsolete
>From 7c7db3db12cf643e812200892d127c95cbee4edd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Aug 2016 16:34:15 +0100 >Subject: [PATCH] Bug 17091: In a first phase, restrict the usage of AUTOLOAD > in Koha::Objects > >To make sure the methods will be covered by tests and devs won't >overused this method, I think it may be a good idea to restrict its >usage. > >Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com> >AUTOLOAD added. No Koha QA errors. Test passed successfully > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Objects.pm | 2 ++ > t/db_dependent/Koha/Objects.t | 8 +++++++- > 2 files changed, 9 insertions(+), 1 deletion(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index 1ff33b3..dd8d221 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -240,9 +240,11 @@ Currently count, pager, reset and update are covered. > sub AUTOLOAD { > my ( $self, @params ) = @_; > >+ my @known_methods = qw( count pager reset update ); > my $method = our $AUTOLOAD; > $method =~ s/.*:://; > >+ carp "The method $method is not covered by tests" and return unless grep {/^$method$/} @known_methods; > my $r = eval { $self->_resultset->$method(@params) }; > if ( $@ ) { > carp "No method $method found for " . ref($self) . " " . $@; >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index d1cb9e1..8e7dc6a 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -19,7 +19,8 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; >+use Test::Warn; > > use Koha::Authority::Types; > use Koha::Cities; >@@ -66,5 +67,10 @@ subtest 'reset' => sub { > is( $patrons->reset->next->borrowernumber, $first_borrowernumber, 'Koha::Objects->reset should work as expected'); > }; > >+subtest 'not_covered_yet' => sub { >+ plan tests => 1; >+ warning_is { Koha::Patrons->search->not_covered_yet } { carped => 'The method not_covered_yet is not covered by tests' }, "If a method is not covered by tests, the AUTOLOAD method won't execute the method"; >+}; >+ > $schema->storage->txn_rollback; > 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 17091
:
54217
|
54218
|
54219
|
54220
|
54221
|
54223
|
54272
|
54273
|
54274
|
54275
|
54276
|
54277
|
55378
|
56142
|
56143
|
56144
|
56145
|
56146
| 56147 |
56148