@@ -337,7 +337,8 @@ function testSendFormats() {
337
337
338
338
// TODO: better test for format of message sent?
339
339
$ this ->Controller ->EmailTest ->sendAs = 'both ' ;
340
- $ expect = str_replace ('{CONTENTTYPE} ' , 'multipart/alternative; boundary="alt-" ' . "\n" , $ message );
340
+ $ expect = str_replace ('{CONTENTTYPE} ' , 'multipart/alternative; boundary="alt-" ' , $ message );
341
+
341
342
$ this ->assertTrue ($ this ->Controller ->EmailTest ->send ('This is the body of the message ' ));
342
343
$ this ->assertEqual ($ this ->Controller ->Session ->read ('Message.email.message ' ), $ this ->__osFix ($ expect ));
343
344
}
@@ -412,10 +413,11 @@ function testTemplates() {
412
413
$ this ->assertEqual ($ this ->Controller ->Session ->read ('Message.email.message ' ), $ this ->__osFix ($ expect ));
413
414
414
415
$ this ->Controller ->EmailTest ->sendAs = 'both ' ;
415
- $ expect = str_replace ('{CONTENTTYPE} ' , 'multipart/alternative; boundary="alt-" ' . "\n" , $ header );
416
+ $ expect = str_replace ('{CONTENTTYPE} ' , 'multipart/alternative; boundary="alt-" ' , $ header );
416
417
$ expect .= '--alt- ' . "\n" . 'Content-Type: text/plain; charset=UTF-8 ' . "\n" . 'Content-Transfer-Encoding: 7bit ' . "\n\n" . $ text . "\n\n" ;
417
418
$ expect .= '--alt- ' . "\n" . 'Content-Type: text/html; charset=UTF-8 ' . "\n" . 'Content-Transfer-Encoding: 7bit ' . "\n\n" . $ html . "\n\n" ;
418
419
$ expect = '<pre> ' . $ expect . '--alt--- ' . "\n\n" . '</pre> ' ;
420
+
419
421
$ this ->assertTrue ($ this ->Controller ->EmailTest ->send ('This is the body of the message ' ));
420
422
$ this ->assertEqual ($ this ->Controller ->Session ->read ('Message.email.message ' ), $ this ->__osFix ($ expect ));
421
423
@@ -588,10 +590,34 @@ function testSendAsIsNotIgnoredIfAttachmentsPresent() {
588
590
$ this ->Controller ->EmailTest ->sendAs = 'both ' ;
589
591
$ this ->assertTrue ($ this ->Controller ->EmailTest ->send ($ body ));
590
592
$ msg = $ this ->Controller ->Session ->read ('Message.email.message ' );
593
+
591
594
$ this ->assertNoPattern ('/text\/plain/ ' , $ msg );
592
595
$ this ->assertNoPattern ('/text\/html/ ' , $ msg );
593
596
$ this ->assertPattern ('/multipart\/alternative/ ' , $ msg );
594
597
}
598
+ /**
599
+ * undocumented function
600
+ *
601
+ * @return void
602
+ * @access public
603
+ */
604
+ function testNoDoubleNewlinesInHeaders () {
605
+ $ this ->Controller ->EmailTest ->reset ();
606
+ $ this ->Controller ->EmailTest ->to = 'postmaster@localhost ' ;
607
+ $ this ->Controller ->EmailTest ->from = 'noreply@example.com ' ;
608
+ $ this ->Controller ->EmailTest ->subject = 'Attachment Test ' ;
609
+ $ this ->Controller ->EmailTest ->replyTo = 'noreply@example.com ' ;
610
+ $ this ->Controller ->EmailTest ->template = null ;
611
+ $ this ->Controller ->EmailTest ->delivery = 'debug ' ;
612
+ $ body = '<p>This is the body of the message</p> ' ;
613
+
614
+ $ this ->Controller ->EmailTest ->sendAs = 'both ' ;
615
+ $ this ->assertTrue ($ this ->Controller ->EmailTest ->send ($ body ));
616
+ $ msg = $ this ->Controller ->Session ->read ('Message.email.message ' );
617
+
618
+ $ this ->assertNoPattern ('/\n\nContent-Transfer-Encoding/ ' , $ msg );
619
+ $ this ->assertPattern ('/\nContent-Transfer-Encoding/ ' , $ msg );
620
+ }
595
621
/**
596
622
* testReset method
597
623
*
0 commit comments