Bugzilla – Attachment 110969 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 ->reset_messages
Bug-26555-QA-follow-up-Add--resetmessages.patch (text/plain), 2.06 KB, created by
Martin Renvoize (ashimema)
on 2020-09-30 08:40:37 UTC
(
hide
)
Description:
Bug 26555: (QA follow-up) Add ->reset_messages
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-09-30 08:40:37 UTC
Size:
2.06 KB
patch
obsolete
>From e16a4790834c1885e2583ca01b6d06aa70cb3890 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 29 Sep 2020 10:13:59 -0300 >Subject: [PATCH] Bug 26555: (QA follow-up) Add ->reset_messages > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Object.pm | 15 +++++++++++++++ > t/db_dependent/Koha/Object.t | 12 ++++++++++-- > 2 files changed, 25 insertions(+), 2 deletions(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index da9315dcc8..3e50181672 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -375,6 +375,21 @@ sub add_message { > return $self; > } > >+=head3 $object->reset_messages >+ >+ $object->reset_messages; >+ >+Reset the current object's messages. >+ >+=cut >+ >+sub reset_messages { >+ my ( $self ) = @_; >+ >+ $self->{_messages} = []; >+ return $self; >+} >+ > =head3 $object->TO_JSON > > Returns an unblessed representation of the object, suitable for JSON output. >diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t >index 9031533113..42fb92fa17 100755 >--- a/t/db_dependent/Koha/Object.t >+++ b/t/db_dependent/Koha/Object.t >@@ -868,9 +868,9 @@ subtest 'set_or_blank' => sub { > $schema->storage->txn_rollback; > }; > >-subtest 'messages() and add_message() tests' => sub { >+subtest 'messages(), add_message() and reset_messages() tests' => sub { > >- plan tests => 6; >+ plan tests => 8; > > my $patron = Koha::Patron->new; > >@@ -887,4 +887,12 @@ subtest 'messages() and add_message() tests' => sub { > is( ref($messages[1]), 'Koha::Object::Message', 'Right type returned' ); > is( $messages[0]->message, 'message_1', 'Right message recorded' ); > is( $messages[1]->message, 'message_2', 'Right message recorded' ); >+ >+ $patron->reset_messages; >+ @messages = @{ $patron->messages }; >+ is( scalar @messages, 0, 'No messages are returned' ); >+ >+ $patron->reset_messages; >+ @messages = @{ $patron->messages }; >+ is( scalar @messages, 0, 'No messages are returned, things ok when calling on already empty list' ); > }; >-- >2.20.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 26555
:
110854
|
110855
|
110911
|
110912
|
110913
|
110957
|
110958
|
110959
|
110967
|
110968
|
110969
|
110983
|
111426
|
111427
|
111428
|
111723