123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <?php
- class TestXmd extends UnitTestCase{
- public $Xmddoc;
- public function TestXmddoc(){
- $this->UnitTestCase('XML Dom Library function tests');
- }
- public function setUp(){
- $this->Xmddoc = new xmddoc();
- }
- public function tearDown(){
- $this->Xmddoc= null;
- }
- public function testXmdGetElement(){
- $parent=0;
- array('?name' => $this->name[$parent],
- '?parent' => $this->parent[$parent]);
- $res = $this->Xmddoc->xmd_get_element($parent);
- if(!is_array($res))
- $this->assertTrue(is_null($res));
- else
- $this->assertTrue(is_array($res));
- //var_dump($res);
- }
- public function testXmdGetNsUri(){
- $parent = 0;
- $attName = '';
- $this->names[$this->ns[$parent]];
- $res = Xmddoc::xmd_get_ns_uri($parent = 0, $attName = '');
- if(is_array($res))
- $this->assertTrue(is_array($res));
- else
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- public function testXmdRemoveElement(){
- $child='';
- $res = Xmddoc:: xmd_remove_element($child);
- $this->assertTrue(is_bool($res));
- $this->assertTrue($res === true || $res ===false);
- //var_dump($res);
- }
- public function testXmdRemoveNodes(){
- $children=2;
- $parent = 1;
- $res = Xmddoc::xmd_remove_nodes($children, $parent = 0);
- $this->assertTrue(is_bool($res));
- $this->assertTrue($res === true || $res === false);
- //var_dump($res);
- }
- /**
- *
- */
- public function testXmdUpdate(){
- $xmPath='';
- $text = '';
- $parent = 0;
- $res = $this->Xmddoc->xmd_update($xmPath, $text, $parent);
- $this->assertTrue(is_bool($res));
- $this->assertTrue($res === true || $res === false);
- //var_dump($res);
- }
- /**
- * this function have work with the method xmddoc
- */
- public function testXmdUpdateMany(){
- $xmPaths='';
- $subPath='';
- $text='';
- $parent='';
- $res = $this->Xmddoc->xmd_update_many($xmPaths, $subPath, $text, $parent);
- $this->assertTrue($res);
- //var_dump($res);
- }
- public function testXmdCopyForeignChild(){
- $fdoc='';
- $fchild='';
- $parent='';
- $res = $this->Xmddoc->xmd_copy_foreign_child($fdoc, $fchild, $parent);
- $this->assertTrue(is_null($res));
- //var_dump($res);
- }
- public function testXmdAddElement(){
- $name='asasasas';
- $parent = 0;
- $attribs = array();
- $res = $this->Xmddoc->xmd_add_element($name, $parent, $attribs);
- $this->assertTrue(is_numeric($res));
- $this->assertTrue($res === -1 || $res === 0);
- //var_dump($res);
- }
- public function testXmdSetAttribute(){
- $parent=0;
- $name='';
- $value=0;
- $checkurihaspfx = TRUE;
- $res = $this->Xmddoc->xmd_set_attribute($parent, $name, $value, $checkurihaspfx);
- $this->assertTrue(is_string($res));
- //var_dump($res);
- }
- public function testXmdAddText(){
- $text='asasasasasa';
- $parent = 1;
- $res = $this->Xmddoc->xmd_add_text($text, $parent = 0);
- $this->assertTrue(is_bool($res));
- $this->assertTrue($res === true || $res === false);
- //var_dump($res);
- }
- public function testXmdAddTextElement(){
- $name='';
- $text='';
- $parent = 0;
- $attribs = array();
- $res = $this->Xmddoc->xmd_add_text_element($name, $text, $parent = 0, $attribs = array());
- $this->assertTrue(is_bool($res) || is_numeric($res));
- //var_dump($res);
- }
- public function testXmdText(){
- $parent = 0;
- $res =$this->Xmddoc->xmd_text($parent = 0);
- $this->assertTrue(is_string($res));
- //var_dump($res);
- }
- public function testXmdXml(){
- $increase = ' ';
- $indent = '';
- $lbr = "\n";
- $parent = 0;
- $res = $this->Xmddoc->xmd_xml($increase, $indent, $lbr, $parent);
- $this->assertTrue(is_string($res));
- //var_dump($res);
- }
- public function testXmdValue($xmPath, $parent, $fix, $fun){
- $xmPath='';
- $parent = 0;
- $fix = array();
- $fun = '';
- $res = $this->Xmddoc->xmd_value($xmPath, $parent, $fix, $fun);
- $this->assertTrue(is_string($res));
- //var_dump($res);
- }
- public function testXmdHtmlValue(){
- $xmPath='';
- $parent = 0;
- $fun = 'htmlspecialchars';
- $res = $this->Xmddoc->xmd_html_value($xmPath, $parent , $fun );
- $this->assertTrue(is_string($res));
- //var_dump($res);
- }
- public function testXmdSelectSingleElement(){
- $xmPath='';
- $parent = 0;
- $res = $this->Xmddoc->xmd_select_single_element($xmPath, $parent);
- $this->assertTrue(is_numeric($res));
- $this->assertTrue($res);
- //var_dump($res);
- }
- public function testXmdSelectElementsWhere(){
- $xmPath='';
- $subPath = '.';
- $value = '';
- $parent = 0;
- $res = $this->Xmddoc->xmd_select_elements_where($xmPath, $subPath, $value, $parent);
- $this->assertTrue(is_array($res));
- //var_dump($res);
- }
- public function testXmdSelectElementsWhereNotempty(){
- $xmPath='';
- $subPath = '.';
- $parent = 0;
- $res = $this->Xmddoc->xmd_select_elements_where_notempty($xmPath,$subPath, $parent);
- $this->assertTrue(is_array($res));
- //var_dump($res);
- }
- public function testxmd_select_elements(){
- $xmPath='';
- $parent = 0;
- $res = $this->Xmddoc->xmd_select_elements($xmPath, $parent);
- $this->assertTrue(is_array($res));
- //var_dump($res);
- }
- public function testXmdSelectElements(){
- $xmPath='';
- $parent = 0;
- $res = $this->Xmddoc-> xmd_select_elements($xmPath, $parent);
- $this->assertTrue(is_array($res));
- //var_dump($res);
- }
- }
- ?>
|