3 require_once 'PHPUnit/Framework.php';
9 * @copyright Copyright (c)2002 - [#]year[#], Blue Static
14 class XmlTest
extends PHPUnit_Framework_TestCase
16 public function setUp()
18 require_once('ISSO/Xml.php');
21 public function testSimpleXmlFile()
25 <elm1>elm1 Value</elm1>
26 <elm1>elm1 Value 2</elm1>
27 <elm2>elm2 Value</elm2>
30 $results = array('root' =>
34 0 => array('value' => 'elm1 Value'),
35 1 => array('value' => 'elm1 Value 2')
37 'elm2' => array('value' => 'elm2 Value')
40 $this->assertEquals($results, BSXml
::Parse($xml));
43 public function testInvalidXml()
45 $xml = '<root><nest1><nest2>soemValue</nest1></nest2></root>';
50 $this->fail('exception expcted');
56 public function testUnifyNode()
60 <elm1>elm1 Value</elm1>
61 <elm1>elm1 Value 2</elm1>
62 <elm2>elm2 Value</elm2>
65 $array = BSXml
::Parse($xml);
66 BSXml
::UnifyNode($array['root']['elm2']);
67 $this->assertEquals($array['root']['elm2'][0]['value'], 'elm2 Value');
70 public function testUtf8Xml()
72 $xml = '<root><utf8>test: π</utf8></root>';
73 $array = BSXml
::Parse($xml, true);
74 $this->assertEquals($array['root']['utf8']['value'], 'test: π');