blob: 1f42285dbd611ec327e8d61ccdb9184a01645d48 (
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
39
|
<?php
use Prado\Exceptions\TInvalidDataTypeException;
use Prado\Xml\TXmlElement;
use Prado\Xml\TXmlElementList;
/**
* @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));
}
}
|