125673c62SAndreas Gohr<?php 2*210e2f5dSAndreas Gohr 325673c62SAndreas Gohr/** 425673c62SAndreas Gohr * General tests for the smtp plugin 525673c62SAndreas Gohr * 625673c62SAndreas Gohr * @group plugin_smtp 725673c62SAndreas Gohr * @group plugins 825673c62SAndreas Gohr */ 9*210e2f5dSAndreas Gohrclass message_plugin_smtp_test extends DokuWikiTest 10*210e2f5dSAndreas Gohr{ 11*210e2f5dSAndreas Gohr public function setUp() 12*210e2f5dSAndreas Gohr { 1325673c62SAndreas Gohr parent::setUp(); 1425673c62SAndreas Gohr require_once __DIR__ . '/../loader.php'; 1525673c62SAndreas Gohr } 1625673c62SAndreas Gohr 17*210e2f5dSAndreas Gohr public function test_body() 18*210e2f5dSAndreas Gohr { 19*210e2f5dSAndreas Gohr $input = join("\r\n", [ 20*210e2f5dSAndreas Gohr 'X-Mailer: DokuWiki', 21*210e2f5dSAndreas Gohr 'X-Dokuwiki-User: admin', 22*210e2f5dSAndreas Gohr 'X-Dokuwiki-Title: Test Wiki', 23*210e2f5dSAndreas Gohr 'X-Dokuwiki-Server: localhost.localhost', 24*210e2f5dSAndreas Gohr 'From: a@example.com', 25*210e2f5dSAndreas Gohr 'To: b@example.com', 26*210e2f5dSAndreas Gohr 'Bcc: c@example.com, d@example.com,', 27*210e2f5dSAndreas Gohr ' d@example.com', 28*210e2f5dSAndreas Gohr 'Subject: A test', 29*210e2f5dSAndreas Gohr '', 30*210e2f5dSAndreas Gohr 'This is the body of the mail', 31*210e2f5dSAndreas Gohr 'Bcc: this is not a header line', 32*210e2f5dSAndreas Gohr 'end of message', 33*210e2f5dSAndreas Gohr ]); 3425673c62SAndreas Gohr 35*210e2f5dSAndreas Gohr $expect = join("\r\n", [ 36*210e2f5dSAndreas Gohr 'X-Mailer: DokuWiki', 37*210e2f5dSAndreas Gohr 'X-Dokuwiki-User: admin', 38*210e2f5dSAndreas Gohr 'X-Dokuwiki-Title: Test Wiki', 39*210e2f5dSAndreas Gohr 'X-Dokuwiki-Server: localhost.localhost', 40*210e2f5dSAndreas Gohr 'From: a@example.com', 41*210e2f5dSAndreas Gohr 'To: b@example.com', 42*210e2f5dSAndreas Gohr 'Subject: A test', 43*210e2f5dSAndreas Gohr '', 44*210e2f5dSAndreas Gohr 'This is the body of the mail', 45*210e2f5dSAndreas Gohr 'Bcc: this is not a header line', 46*210e2f5dSAndreas Gohr 'end of message', 47*210e2f5dSAndreas Gohr ]); 4825673c62SAndreas Gohr $expect .= "\r\n\r\n.\r\n"; 4925673c62SAndreas Gohr 5025673c62SAndreas Gohr $message = new \splitbrain\dokuwiki\plugin\smtp\Message('', '', $input); 5125673c62SAndreas Gohr 5225673c62SAndreas Gohr $this->assertEquals($expect, $message->toString()); 5325673c62SAndreas Gohr 5425673c62SAndreas Gohr } 5525673c62SAndreas Gohr} 56