コード例 #1
0
ファイル: LockTest.php プロジェクト: samizdam/WebDAV
 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());
 }
コード例 #2
0
ファイル: LockDiscovery.php プロジェクト: samizdam/WebDAV
 /**
  * @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);
 }