Bugzilla – Attachment 130010 Details for
Bug 29857
We must stringify our exceptions correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29857: Unit tests
Bug-29857-Unit-tests.patch (text/plain), 2.06 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-01-31 15:18:09 UTC
(
hide
)
Description:
Bug 29857: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-01-31 15:18:09 UTC
Size:
2.06 KB
patch
obsolete
>From 39ab996dc8a01796dd6d540bf361157454fb0c1c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 31 Jan 2022 12:06:46 -0300 >Subject: [PATCH] Bug 29857: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/Koha/Exceptions.t | 49 ++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 48 insertions(+), 1 deletion(-) > >diff --git a/t/Koha/Exceptions.t b/t/Koha/Exceptions.t >index 56107fccc4..5a33c04a91 100755 >--- a/t/Koha/Exceptions.t >+++ b/t/Koha/Exceptions.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 9; >+use Test::More tests => 10; > use Test::MockObject; > use Test::Exception; > >@@ -336,3 +336,50 @@ subtest 'Koha::Exceptions::Plugin tests' => sub { > # stringify the exception > is( "$@", "Calling 'upgrade' died for plugin $plugin_class", 'Exception stringified correctly' ); > }; >+ >+subtest 'Koha::Exception tests' => sub { >+ >+ plan tests => 6; >+ >+ use Koha::Exception; >+ >+ use Exception::Class ( >+ 'Koha::Exceptions::Weird' => { >+ isa => 'Koha::Exception', >+ description => 'Weird exception!', >+ fields => [ 'a', 'b' ] >+ } >+ ); >+ >+ my $exception_message = "This is a message"; >+ >+ throws_ok >+ { Koha::Exceptions::Weird->throw( $exception_message ) } >+ 'Koha::Exception', >+ 'Exception is thrown :-D'; >+ >+ is( "$@", $exception_message, 'Exception not stringified if manually passed' ); >+ >+ >+ throws_ok >+ { Koha::Exceptions::Weird->throw( a => "A", b => "B" ) } >+ 'Koha::Exception', >+ 'Exception is thrown :-D'; >+ >+ is( >+ "$@", >+ "Exception 'Koha::Exceptions::Weird' thrown 'Weird exception!' with a => A, b => B\n", >+ 'Exception stringified correctly' >+ ); >+ >+ throws_ok >+ { Koha::Exceptions::Weird->throw() } >+ 'Koha::Exception', >+ 'Exception is thrown :-D'; >+ >+ is( >+ "$@", >+ "Exception 'Koha::Exceptions::Weird' thrown 'Weird exception!'\n", >+ 'Exception not stringified if manually passed' >+ ); >+}; >-- >2.32.0
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 29857
:
129329
|
129330
|
130007
|
130008
|
130009
|
130010
|
130011
|
130012
|
130013
|
130014
|
130015
|
130156
|
130157
|
130158
|
130355
|
131112
|
131113
|
131114
|
131115
|
131116
|
131117
|
131232
|
131240
|
131241
|
131242
|
131243
|
131244
|
131256
|
131258
|
131287
|
131288
|
131289
|
131290
|
131291