diff options
author | xue <> | 2006-07-07 14:54:15 +0000 |
---|---|---|
committer | xue <> | 2006-07-07 14:54:15 +0000 |
commit | 61bb16ee2e5f0a66234e1575242169a10fde47b5 (patch) | |
tree | 3ee24dcc36ceae2c213130df1ea3d5c9fc110a27 /tests/UnitTests/framework/Data/utXmlDocument.php | |
parent | 7b84938b1b5964f2274d66e28ba17435924ffe35 (diff) |
Merge from 3.0 branch till 1253.
Diffstat (limited to 'tests/UnitTests/framework/Data/utXmlDocument.php')
-rw-r--r-- | tests/UnitTests/framework/Data/utXmlDocument.php | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/tests/UnitTests/framework/Data/utXmlDocument.php b/tests/UnitTests/framework/Data/utXmlDocument.php deleted file mode 100644 index ec0e43c7..00000000 --- a/tests/UnitTests/framework/Data/utXmlDocument.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php
-
-require_once(dirname(__FILE__).'/../common.php');
-
-class utXmlDocument extends UnitTestCase
-{
- public function setUp()
- {
- }
-
- public function tearDown()
- {
- }
-
- public function testLoadAndSave()
- {
- $dir=dirname(__FILE__).'/xml';
-
- $doc=new TXmlDocument;
- try
- {
- $doc->loadFromFile('nonexisting.xml');
- $this->fail('exception not raised when openning a nonexistent file.');
- }
- catch(TIOException $e)
- {
- $this->pass();
- }
-
- $doc=new TXmlDocument;
- $this->assertFalse(@$doc->loadFromString('$12341'));
-
- // a regular XML file
- $doc=new TXmlDocument;
- $doc->loadFromFile($dir.'/data1.xml');
- $doc->saveToFile($dir.'/data1.xml.tmp');
- $this->assertTrue($this->compareFiles($dir.'/data1.xml.tmp',$dir.'/data1.xml.out'));
- @unlink($dir.'/data1.xml.tmp');
-
- // an XML file with Chinese characters
- $doc->loadFromFile($dir.'/data2.xml');
- $doc->saveToFile($dir.'/data2.xml.tmp');
- $this->assertTrue($this->compareFiles($dir.'/data2.xml.tmp',$dir.'/data2.xml.out'));
- @unlink($dir.'/data2.xml.tmp');
-
- // a typical Prado Application configuration file
- $doc=new TXmlDocument;
- $doc->loadFromFile($dir.'/data3.xml');
- $doc->saveToFile($dir.'/data3.xml.tmp');
- $this->assertTrue($this->compareFiles($dir.'/data3.xml.tmp',$dir.'/data3.xml.out'));
- @unlink($dir.'/data3.xml.tmp');
- }
-
- protected function compareFiles($file1,$file2)
- {
- return file_get_contents($file1)===file_get_contents($file2);
- }
-
- public function testAccessDomTree()
- {
- $dir=dirname(__FILE__).'/xml';
- $doc=new TXmlDocument;
- $doc->loadFromFile($dir.'/data1.xml');
- $this->assertTrue($doc->getVersion()==='1.0');
- $this->assertTrue($doc->getEncoding()==='utf-8');
- $this->assertTrue($doc->getElements()->getCount()===2);
- $this->assertTrue($doc->getElements()->itemAt(0)->getTagName()==='title');
- $this->assertTrue($doc->getElements()->itemAt(0)->getValue()==='My lists');
- $this->assertTrue($doc->getElements()->itemAt(1)->getTagName()==='chapter');
- $this->assertTrue($doc->getElements()->itemAt(1)->getAttribute('id')==='books');
- }
-
- public function testUpdateDomTree()
- {
- }
-
- public function testComposeDomTree()
- {
- }
-}
-
-?>
\ No newline at end of file |