blob: 16384078d1e03f43d056454f4c0b623a5ae32f18 (
plain)
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
|
<?php
require_once dirname(__FILE__).'/../phpunit.php';
Prado::using('System.Xml.TXmlDocument');
/**
* @package System.Xml
*/
class TXmlElementListTest extends PHPUnit_Framework_TestCase {
public function testConstruct() {
$element=new TXmlElement('tag');
$list=new TXmlElementList($element);
self::assertEquals($element,self::readAttribute($list, '_o'));
}
public function testInsertAt() {
$element=new TXmlElement('tag');
$list=new TXmlElementList($element);
try {
$list->insertAt(0,'ABadElement');
self::fail('Expected TInvalidDataTypeException not thrown');
} catch (TInvalidDataTypeException $e) {}
$newElement=new TXmlElement('newTag');
$list->insertAt(0,$newElement);
self::assertEquals($newElement,$list->itemAt(0));
}
public function testRemoveAt() {
$element=new TXmlElement('tag');
$list=new TXmlElementList($element);
$newElement=new TXmlElement('newTag');
$list->insertAt(0,$newElement);
self::assertEquals($newElement,$list->removeAt(0));
}
}
?>
|