/usr/share/php/tests/Horde_Mime/Horde/Mime/RelatedTest.php is in php-horde-mime 2.2.8-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | <?php
/**
* Tests for the Horde_Mime_Related class.
*
* Copyright 2012-2013 Horde LLC (http://www.horde.org/)
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Mime
* @subpackage UnitTests
*/
/**
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Mime
* @subpackage UnitTests
*/
class Horde_Mime_RelatedTest extends PHPUnit_Framework_TestCase
{
private $_part;
private $_relatedOb;
public function setUp()
{
$this->_part = Horde_Mime_Part::parseMessage(file_get_contents(__DIR__ . '/fixtures/related_msg.txt'));
$this->_relatedOb = new Horde_Mime_Related($this->_part);
}
public function tearDown()
{
unset($this->_part, $this->_relatedOb);
}
public function testStart()
{
$this->assertEquals(
1,
$this->_relatedOb->startId()
);
}
public function testSearch()
{
$this->assertEquals(
3,
$this->_relatedOb->cidSearch('789')
);
}
public function testIterator()
{
$this->assertEquals(
array('2' => '456', '3' => '789'),
iterator_to_array($this->_relatedOb)
);
}
public function testReplace()
{
$ob = $this->_relatedOb->cidReplace(
$this->_part->getPart('1')->getContents(),
array($this, 'callbackTestReplace')
);
$expected = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body background="2">
<div>
Foo.
<img src="3"></div>
</body></html>
EOT;
$this->assertEquals(
$expected,
$ob->returnHtml()
);
}
public function callbackTestReplace($id)
{
return $id;
}
}
|