Bugzilla – Attachment 40216 Details for
Bug 8000
Test mode for notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8000 - Missing test to trigger code change
Bug-8000---Missing-test-to-trigger-code-change.patch (text/plain), 3.21 KB, created by
Mark Tompsett
on 2015-06-17 10:58:46 UTC
(
hide
)
Description:
Bug 8000 - Missing test to trigger code change
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-06-17 10:58:46 UTC
Size:
3.21 KB
patch
obsolete
>From c25fe1e74aa6d6fd77bd7efd982d0e2d36660cb5 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Thu, 6 Mar 2014 16:59:44 -0500 >Subject: [PATCH] Bug 8000 - Missing test to trigger code change > >This adds a test case which will trigger _send_message_by_email >and thus provide a way to run the changes made. >--- > t/db_dependent/Letters.t | 28 ++++++++++++++++++++++++---- > 1 file changed, 24 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t >index 356b075..d41434e 100644 >--- a/t/db_dependent/Letters.t >+++ b/t/db_dependent/Letters.t >@@ -18,7 +18,7 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 61; >+use Test::More tests => 63; > use Test::MockModule; > use Test::Warn; > >@@ -86,6 +86,7 @@ is_deeply( $mtts, ['email', 'phone', 'print', 'sms'], 'GetMessageTransportTypes > # EnqueueLetter > is( C4::Letters::EnqueueLetter(), undef, 'EnqueueLetter without argument returns undef' ); > >+# used to trigger _send_message_by_sms in C4::Letter > my $my_message = { > borrowernumber => $borrowernumber, > message_transport_type => 'sms', >@@ -110,13 +111,30 @@ $my_message->{message_transport_type} = 'sms'; > $message_id = C4::Letters::EnqueueLetter($my_message); > ok(defined $message_id && $message_id > 0, 'new message successfully queued'); > >+# used to trigger _send_message_by_email in C4::Letter >+my $message_id2 = C4::Letters::EnqueueLetter({ >+ borrowernumber => $borrowernumber, >+ message_transport_type => 'email', >+ to_address => 'to@example.com', >+ from_address => 'from@example.com', >+ letter => { >+ content => 'a message', >+ title => 'message title', >+ metadata => 'metadata', >+ code => 'TEST_MESSAGE', >+ content_type => 'text/plain', >+ }, >+}); >+ >+ok(defined $message_id2 && $message_id2 > 0, 'new message successfully queued'); >+ > > # GetQueuedMessages > my $messages = C4::Letters::GetQueuedMessages(); >-is( @$messages, 1, 'GetQueuedMessages without argument returns all the entries' ); >+is( @$messages, 2, 'GetQueuedMessages without argument returns all the entries' ); > > $messages = C4::Letters::GetQueuedMessages({ borrowernumber => $borrowernumber }); >-is( @$messages, 1, 'one message stored for the borrower' ); >+is( @$messages, 2, 'two messages stored for the borrower' ); > is( $messages->[0]->{message_id}, $message_id, 'EnqueueLetter returns the message id correctly' ); > is( $messages->[0]->{borrowernumber}, $borrowernumber, 'EnqueueLetter stores the borrower number correctly' ); > is( $messages->[0]->{subject}, $my_message->{letter}->{title}, 'EnqueueLetter stores the subject correctly' ); >@@ -127,9 +145,11 @@ is( $messages->[0]->{status}, 'pending', 'EnqueueLetter stores the status pendin > > # SendQueuedMessages > my $messages_processed = C4::Letters::SendQueuedMessages(); >-is($messages_processed, 1, 'all queued messages processed'); >+is($messages_processed, 2, 'all queued messages processed'); > > $messages = C4::Letters::GetQueuedMessages({ borrowernumber => $borrowernumber }); >+is(scalar(@$messages), 2, 'two messages stored for the borrower'); >+ > is( > $messages->[0]->{status}, > 'failed', >-- >2.1.4
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 8000
:
21976
|
22315
|
24784
|
25917
|
25919
|
25920
|
25923
|
25924
|
25925
|
25926
|
25927
|
25928
|
25939
|
25950
|
25951
|
26446
|
37463
|
37464
|
37465
|
37466
|
37467
|
37468
|
37469
|
37472
|
37473
|
37474
|
37475
|
37476
|
37477
|
37478
|
37481
|
37482
|
37483
|
37484
|
37485
|
37486
|
37487
|
39985
|
39986
|
39987
|
39988
|
39989
|
39990
|
39991
|
39992
|
40215
|
40216
|
40217
|
40218
|
40219
|
40220
|
40221
|
40222
|
40223
|
40224
|
40225
|
40226
|
40227
|
40228
|
40229
|
40230
|
46354
|
46355
|
46356
|
46357
|
46358
|
46359
|
46360
|
46361
|
46362
|
49991
|
49992
|
49993
|
49998
|
49999
|
50000
|
55940
|
58434
|
62863
|
67155
|
70086
|
70087
|
70484
|
74110
|
74111
|
74848
|
80370
|
81487
|
81488
|
81589
|
81590
|
81591
|
84801
|
84802
|
84803
|
84804
|
84805
|
86861
|
86862
|
86863
|
86864
|
86865
|
88874
|
88875
|
88876
|
88877
|
88878
|
88879