Bugzilla – Attachment 56461 Details for
Bug 17425
Koha::Object should raise exceptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17425: Add the Object::MethodNotCoveredByTests exception
Bug-17425-Add-the-ObjectMethodNotCoveredByTests-ex.patch (text/plain), 2.23 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-10-14 07:57:55 UTC
(
hide
)
Description:
Bug 17425: Add the Object::MethodNotCoveredByTests exception
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-10-14 07:57:55 UTC
Size:
2.23 KB
patch
obsolete
>From ddfa52be47bba9138559dd84fc27203278111e83 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 13 Oct 2016 14:17:13 +0100 >Subject: [PATCH] Bug 17425: Add the Object::MethodNotCoveredByTests exception > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Exceptions/Object.pm | 6 +++++- > Koha/Object.pm | 2 +- > t/db_dependent/Koha/Objects.t | 4 ++-- > 3 files changed, 8 insertions(+), 4 deletions(-) > >diff --git a/Koha/Exceptions/Object.pm b/Koha/Exceptions/Object.pm >index e08b5a5..2ffa1ec 100644 >--- a/Koha/Exceptions/Object.pm >+++ b/Koha/Exceptions/Object.pm >@@ -14,7 +14,11 @@ use Exception::Class ( > 'Koha::Exceptions::Object::PropertyNotFound' => { > isa => 'Koha::Exceptions::Object', > description => "Invalid property", >- } >+ }, >+ 'Koha::Exceptions::Object::MethodNotCoveredByTests' => { >+ isa => 'Koha::Exceptions::Object', >+ description => "Method not covered by tests", >+ }, > ); > > 1; >diff --git a/Koha/Object.pm b/Koha/Object.pm >index d2a1d6d..fe3c40e 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -239,7 +239,7 @@ sub AUTOLOAD { > > my @known_methods = qw( is_changed id in_storage get_column ); > >- carp "The method $method is not covered by tests or does not exist!" and return unless grep {/^$method$/} @known_methods; >+ Koha::Exceptions::Object::MethodNotCoveredByTests->throw( "The method $method is not covered by tests!" ) unless grep {/^$method$/} @known_methods; > > my $r = eval { $self->_result->$method(@_) }; > if ( $@ ) { >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index 61aaefb..41ac8cc 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -93,8 +93,8 @@ subtest 'Exceptions' => sub { > try { > $patron->blah('blah'); > } catch { >- ok( $_->isa('Koha::Exceptions::Object::MethodNotFound'), >- 'Calling a non-existent method should raise a Koha::Exceptions::Object::MethodNotFound exception' ); >+ ok( $_->isa('Koha::Exceptions::Object::MethodNotCoveredByTests'), >+ 'Calling a non-covered method should raise a Koha::Exceptions::Object::MethodNotCoveredByTests exception' ); > }; > > try { >-- >2.10.1
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 17425
:
56168
|
56169
|
56170
|
56187
|
56188
|
56220
|
56221
|
56393
|
56394
|
56395
|
56459
|
56460
| 56461