Bugzilla – Attachment 49060 Details for
Bug 11904
Proposal for a uniform way to send messages to user interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11904: Unit tests for Koha::Messages
Bug-11904-Unit-tests-for-KohaMessages.patch (text/plain), 1.66 KB, created by
Julian Maurice
on 2016-03-12 07:29:40 UTC
(
hide
)
Description:
Bug 11904: Unit tests for Koha::Messages
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2016-03-12 07:29:40 UTC
Size:
1.66 KB
patch
obsolete
>From e190efe2817de4ab4f2727dea65c2ef0096192e6 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Thu, 6 Mar 2014 08:47:59 +0100 >Subject: [PATCH] Bug 11904: Unit tests for Koha::Messages > >--- > t/db_dependent/Koha/Messages.t | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > create mode 100755 t/db_dependent/Koha/Messages.t > >diff --git a/t/db_dependent/Koha/Messages.t b/t/db_dependent/Koha/Messages.t >new file mode 100755 >index 0000000..ac5ab3e >--- /dev/null >+++ b/t/db_dependent/Koha/Messages.t >@@ -0,0 +1,40 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+use Test::More tests => 4; >+use Test::MockModule; >+use C4::Auth qw(get_session); >+ >+use_ok('Koha::Messages'); >+ >+# Create a new session and save it immediately in database. >+my $session = get_session(''); >+$session->flush; >+ >+# Mock CGI::cookie to return the CGISESSID of just created session. >+my $cgi_module = new Test::MockModule('CGI'); >+$cgi_module->mock('cookie', sub { >+ my ($self, $name) = @_; >+ return $session->id if ($name eq 'CGISESSID'); >+}); >+ >+my $messages = messages_get(); >+is_deeply($messages, {}, "no messages at beginning"); >+ >+messages_set('ok 1'); >+messages_set('warning 1', 'warning'); >+messages_set('error 1', 'error'); >+messages_set('ok 2'); >+messages_set('warning 2', 'warning'); >+messages_set('error 2', 'error'); >+ >+$messages = messages_get(); >+my $expected = { >+ 'ok' => ['ok 1', 'ok 2'], >+ 'warning' => ['warning 1', 'warning 2'], >+ 'error' => ['error 1', 'error 2'], >+}; >+is_deeply($messages, $expected, "messages successfully retrieved"); >+ >+$messages = messages_get(); >+is_deeply($messages, {}, "messages emptied automatically"); >-- >1.9.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 11904
:
25910
|
25911
|
25912
|
27940
|
27941
|
27942
|
29545
|
29546
|
29547
|
29552
|
29553
|
29554
|
30579
|
30580
|
30581
|
38522
|
38523
|
38524
|
40960
|
40961
|
40962
|
48415
|
48416
|
48417
|
48418
|
49059
|
49060
|
49061
|
49263
|
49264
|
49265