Example #1
0
 public function testIsInitialized()
 {
     $e = new Horde_Xml_Element('<element />');
     $e->author->name['last'] = 'Lastname';
     $e->author->name['first'] = 'Firstname';
     $e->author->name->{'Firstname:url'} = 'www.example.com';
     $e->author->title['foo'] = 'bar';
     if ($e->pants()) {
         $this->fail('<pants> does not exist, it should not have a true value');
         // This should not create an element in the actual tree.
     }
     if ($e->pants()) {
         $this->fail('<pants> should not have been created by testing for it');
         // This should not create an element in the actual tree.
     }
     $xml = $e->saveXML();
     $this->assertFalse(strpos($xml, 'pants'), '<pants> should not be in the xml output');
     $this->assertTrue(strpos($xml, 'www.example.com') !== false, 'the url attribute should be set');
 }