1: <?php
2: /**
3: * Horde test case helper.
4: *
5: * PHP version 5
6: *
7: * @category Horde
8: * @package Test
9: * @author Chuck Hagenbuch <chuck@horde.org>
10: * @license http://www.horde.org/licenses/lgpl21 LGPL
11: * @link http://www.horde.org/components/Horde_Test
12: */
13:
14: /**
15: * Horde test case helper.
16: *
17: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
18: *
19: * See the enclosed file COPYING for license information (LGPL). If you
20: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
21: *
22: * @category Horde
23: * @package Test
24: * @author Chuck Hagenbuch <chuck@horde.org>
25: * @license http://www.horde.org/licenses/lgpl21 LGPL
26: * @link http://www.horde.org/components/Horde_Test
27: */
28: class Horde_Test_Functional extends Horde_Test_Case
29: {
30: /**
31: * Test two XML strings for equivalency (e.g., identical up to reordering of
32: * attributes).
33: */
34: public function assertDomEquals($expected, $actual, $message = null)
35: {
36: $expectedDom = new DOMDocument();
37: $expectedDom->loadXML($expected);
38:
39: $actualDom = new DOMDocument();
40: $actualDom->loadXML($actual);
41:
42: $this->assertEquals($expectedDom->saveXML(), $actualDom->saveXML(), $message);
43: }
44:
45: /**
46: * Test two HTML strings for equivalency (e.g., identical up to reordering
47: * of attributes).
48: */
49: public function assertHtmlDomEquals($expected, $actual, $message = null)
50: {
51: $expectedDom = new DOMDocument();
52: $expectedDom->loadHTML($expected);
53:
54: $actualDom = new DOMDocument();
55: $actualDom->loadHTML($actual);
56:
57: $this->assertEquals($expectedDom->saveHTML(), $actualDom->saveHTML(), $message);
58: }
59: }
60: