/
FilterDataTest.php
53 lines (47 loc) · 1.29 KB
/
FilterDataTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
* Copyright 2013 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @copyright 2013 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Smtp
* @subpackage UnitTests
*/
/**
* Test for the SMTP DATA filter.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2013 Horde LLC
* @ignore
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Smtp
* @subpackage UnitTests
*/
class Horde_Smtp_FilterDataTest extends Horde_Test_Case
{
private $stream;
public function setUp()
{
$this->stream = fopen('php://temp', 'r+');
stream_filter_register('horde_smtp_data', 'Horde_Smtp_Filter_Data');
stream_filter_append($this->stream, 'horde_smtp_data', STREAM_FILTER_READ);
}
public function tearDown()
{
fclose($this->stream);
}
public function testLeadingPeriodsEscape()
{
fwrite($this->stream, "Foo\r\n.\r\nFoo\r\n");
rewind($this->stream);
$this->assertEquals(
"Foo\r\n..\r\nFoo\r\n",
stream_get_contents($this->stream)
);
}
}