3 // Copyright (c) 2011 Blue Static
5 // This program is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation, either version 3 of the License, or any later version.
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 // You should have received a copy of the GNU General Public License along with
15 // this program. If not, see <http://www.gnu.org/licenses/>.
17 namespace hoplite
\test
;
18 use hoplite\http
as http
;
20 require_once HOPLITE_ROOT
. '/http/output_filter.php';
22 class TestOutputFilter
extends http\OutputFilter
24 public function T_EncodeXML($d)
26 return $this->_EncodeXML($d);
30 class OutputFilterTest
extends \PHPUnit_Framework_TestCase
32 public function setUp()
34 $this->fixture
= new TestOutputFilter(new http\
RootController(array()));
37 public function testEncodeXML()
42 'bar' => '<strong>baz</strong>',
50 <response
><test
>1</test
><foo
>bar
</foo
><bar
><
;strong
>
;baz
<
;/strong
>
;</bar
><baz
><poo
>moo
</poo
><moo
>baa
</moo
></baz
></response
>
54 $this->assertEquals($expected, $this->fixture
->T_EncodeXML($array));
56 $obj = new \
stdClass();
58 $obj->obj
= new \
stdClass();
59 $obj->obj
->string = 'Foo';
62 <response
><int>2</int><obj
><string>Foo
</string></obj
></response
>
65 $this->assertEquals($expected, $this->fixture
->T_EncodeXML($obj));