Bugzilla – Attachment 54277 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]
[SIGNED-OFF]Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects
SIGNED-OFFBug-17091-In-a-first-phase-restrict-the-.patch (text/plain), 2.08 KB, created by
Héctor Eduardo Castro Avalos
on 2016-08-10 14:44:41 UTC
(
hide
)
Description:
[SIGNED-OFF]Bug 17091: In a first phase, restrict the usage of AUTOLOAD in Koha::Objects
Filename:
MIME Type:
Creator:
Héctor Eduardo Castro Avalos
Created:
2016-08-10 14:44:41 UTC
Size:
2.08 KB
patch
obsolete
>From d2dcf9784c321258c185e60a7a7ed9cde0f51fb1 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] [SIGNED-OFF]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 >--- > 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; >-- >1.7.10.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