From b6c97c7072748fa573d54a91c1be14e496fd9990 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 3 Aug 2013 22:26:38 +0200 Subject: FS#2677 support arrays in to, cc, bcc headers in Mailer This does not fix FS#2677, it only adds support for fixing it later. --- _test/tests/inc/mailer.test.php | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to '_test') diff --git a/_test/tests/inc/mailer.test.php b/_test/tests/inc/mailer.test.php index 053e216b8..ef78692b3 100644 --- a/_test/tests/inc/mailer.test.php +++ b/_test/tests/inc/mailer.test.php @@ -15,6 +15,11 @@ class TestMailer extends Mailer { public function prepareHeaders() { return parent::prepareHeaders(); } + + public function cleanHeaders() { + parent::cleanHeaders(); + } + } class mailer_test extends DokuWikiTest { @@ -67,6 +72,47 @@ class mailer_test extends DokuWikiTest { $this->assertArrayNotHasKey('Test-Header',$headers); } + function test_addresses(){ + $mail = new TestMailer(); + + $mail->to('andi@splitbrain.org'); + $mail->cleanHeaders(); + $headers = $mail->prop('headers'); + $this->assertEquals('andi@splitbrain.org', $headers['To']); + + $mail->to(''); + $mail->cleanHeaders(); + $headers = $mail->prop('headers'); + $this->assertEquals('andi@splitbrain.org', $headers['To']); + + $mail->to('Andreas Gohr '); + $mail->cleanHeaders(); + $headers = $mail->prop('headers'); + $this->assertEquals('Andreas Gohr ', $headers['To']); + + $mail->to('Andreas Gohr , foo '); + $mail->cleanHeaders(); + $headers = $mail->prop('headers'); + $this->assertEquals('Andreas Gohr , foo ', $headers['To']); + + $mail->to('Möp , foo '); + $mail->cleanHeaders(); + $headers = $mail->prop('headers'); + $this->assertEquals('=?UTF-8?B?TcO2cA==?= , foo ', $headers['To']); + + $mail->to(array('Möp ',' foo ')); + $mail->cleanHeaders(); + $headers = $mail->prop('headers'); + $this->assertEquals('=?UTF-8?B?TcO2cA==?= , foo ', $headers['To']); + + $mail->to(array('Beet, L van ',' foo ')); + $mail->cleanHeaders(); + $headers = $mail->prop('headers'); + $this->assertEquals('=?UTF-8?B?QmVldCwgTCB2YW4=?= , foo ', $headers['To']); + + + } + function test_simplemail(){ global $conf; $conf['htmlmail'] = 0; -- cgit v1.2.3