Bugzilla – Attachment 111723 Details for
Bug 26555
Add a way for Koha::Object(s) to carry execution information
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26555: (QA follow-up) Add a 'payload' attribute for carrying useful things
Bug-26555-QA-follow-up-Add-a-payload-attribute-for.patch (text/plain), 2.55 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-10-15 12:36:12 UTC
(
hide
)
Description:
Bug 26555: (QA follow-up) Add a 'payload' attribute for carrying useful things
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-10-15 12:36:12 UTC
Size:
2.55 KB
patch
obsolete
>From 1ec315b1de2f86d4df2b2527010e461f54e23c3a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 15 Oct 2020 09:35:43 -0300 >Subject: [PATCH] Bug 26555: (QA follow-up) Add a 'payload' attribute for > carrying useful things > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/Object/Message.pm | 9 ++++++--- > t/Koha/Object/Message.t | 7 ++++++- > 2 files changed, 12 insertions(+), 4 deletions(-) > >diff --git a/Koha/Object/Message.pm b/Koha/Object/Message.pm >index 42349c98644..987abe4551b 100644 >--- a/Koha/Object/Message.pm >+++ b/Koha/Object/Message.pm >@@ -21,7 +21,7 @@ use base qw(Class::Accessor); > > use Koha::Exceptions; > >-__PACKAGE__->mk_ro_accessors(qw( message type )); >+__PACKAGE__->mk_ro_accessors(qw( message payload type )); > > =head1 NAME > >@@ -41,7 +41,8 @@ Koha::Object::Message - Class encapsulating action feedback messages in Koha::Ob > my $message = Koha::Object::Message->new( > { > message => $some_message, >- [ type => 'error' ] >+ [ type => 'error', >+ payload => $payload ] > } > ); > >@@ -54,6 +55,7 @@ sub new { > > my $message = $params->{message}; > my $type = $params->{type} // 'error'; >+ my $payload = $params->{payload}; > > Koha::Exceptions::MissingParameter->throw( "Mandatory parameter missing: 'message'" ) > unless $message; >@@ -61,7 +63,8 @@ sub new { > my $self = $class->SUPER::new( > { > message => $message, >- type => $type >+ type => $type, >+ payload => $payload, > } > ); > >diff --git a/t/Koha/Object/Message.t b/t/Koha/Object/Message.t >index 04bbe5e7967..6eb2f2e8724 100755 >--- a/t/Koha/Object/Message.t >+++ b/t/Koha/Object/Message.t >@@ -28,7 +28,7 @@ BEGIN { > > subtest 'new() tests' => sub { > >- plan tests => 8; >+ plan tests => 11; > > my $some_error = 'Some error'; > >@@ -42,6 +42,11 @@ subtest 'new() tests' => sub { > is( $message->message, $some_error, 'The message attribute has the right value' ); > is( $message->type, 'callback', 'type is correct' ); > >+ $message = Koha::Object::Message->new({ message => $some_error, payload => { some => 'structure' } }); >+ is( ref($message), 'Koha::Object::Message', 'Type is correct' ); >+ is( $message->message, $some_error, 'The message attribute has the right value' ); >+ is_deeply( $message->payload, { some => 'structure' }, 'payload is correct' ); >+ > throws_ok > { Koha::Object::Message->new({ blah => 'ohh' }); } > 'Koha::Exceptions::MissingParameter', >-- >2.28.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 26555
:
110854
|
110855
|
110911
|
110912
|
110913
|
110957
|
110958
|
110959
|
110967
|
110968
|
110969
|
110983
|
111426
|
111427
|
111428
| 111723