Bugzilla – Attachment 37482 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-04-03 17:48:12 UTC
(
hide
)
Description:
Bug 8000 - Missing test to trigger code change
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-04-03 17:48:12 UTC
Size:
3.21 KB
patch
obsolete
>From a010fbc515dae556c35baab607dcdfd12a3d7984 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 f53e75b..b0143e2 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 => 58; >+use Test::More tests => 60; > use Test::MockModule; > use Test::Warn; > >@@ -82,6 +82,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', >@@ -106,13 +107,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' ); >@@ -123,9 +141,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', >-- >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 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