Ejemplo n.º 1
0
 public function testFromLockInfoXml()
 {
     $dom = new \DOMDocument();
     $dom->loadXML('<?xml version="1.0" encoding="utf-8"?>
         <D:lockinfo xmlns:D="DAV:">
           <D:locktype><D:write/></D:locktype>
           <D:lockscope><D:exclusive/></D:lockscope>
           <D:owner>
             <D:href>http://example.org/~ejw/contact.html</D:href>
           </D:owner>
         </D:lockinfo>');
     $lock = Lock::fromXml($dom->documentElement);
     $this->assertEquals('write', $lock->getType());
     $this->assertEquals('exclusive', $lock->getScope());
     $this->assertEquals('http://example.org/~ejw/contact.html', $lock->getOwner());
     $this->assertEmpty($lock->getToken());
 }
Ejemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public static function fromXml(\DOMElement $element, array $xmlNamespaces = array())
 {
     $locks = array();
     foreach ($element->getElementsByTagNameNS('DAV:', 'activelock') as $xActiveLock) {
         $locks[] = Lock::fromXml($xActiveLock);
     }
     return new self($locks);
 }