/** * testExtractLiveProperty * * @param mixed $xml * @param mixed $result * @return void * * @dataProvider provideLivePropertyData */ public function testSerializeProperty($xml, $property) { $xmlTool = new ezcWebdavXmlTool(); $expectedElement = $xmlTool->createDomDocument($xml)->documentElement; $dummyDom = $xmlTool->createDomDocument(); $dummyDomElement = $dummyDom->appendChild($xmlTool->createDomElement($dummyDom, 'prop')); $resultElement = $this->propertyHandler->serializeLiveProperty($property, $dummyDomElement, $xmlTool); $this->assertEquals($expectedElement, $resultElement); }
/** * testExtractLiveProperty * * @param mixed $xml * @param mixed $result * @return void * * @dataProvider provideLivePropertyData */ public function testSerializeProperty($xml, $property) { $xmlTool = new ezcWebdavXmlTool(); $expectedElement = $xmlTool->createDomDocument($xml)->documentElement; $dummyDom = $xmlTool->createDomDocument(); $dummyDomElement = $dummyDom->appendChild($xmlTool->createDomElement($dummyDom, 'prop')); $resultElement = $this->propertyHandler->serializeLiveProperty($property, $dummyDomElement, $xmlTool); // @TODO: This does not validate the XML needs to be refactored! $this->assertDomTreeEquals($expectedElement, $resultElement); }
/** * Serializes an array of ezcWebdavSupportedLockPropertyLockentry elements to XML. * * @param ArrayObject(ezcWebdavSupportedLockPropertyLockentry) $lockEntries * @param DOMDocument $dom To create the returned DOMElements. * @param ezcWebdavXmlTool $xmlTool * @return array(DOMElement) */ protected function serializeLockEntryContent(ArrayObject $lockEntries = null, DOMDocument $dom, ezcWebdavXmlTool $xmlTool) { $lockEntryContentElements = array(); foreach ($lockEntries as $lockEntry) { $lockEntryElement = $xmlTool->createDomElement($dom, 'lockentry'); $lockEntryElement->appendChild($xmlTool->createDomElement($dom, 'lockscope'))->appendChild($xmlTool->createDomElement($dom, $lockEntry->lockScope === ezcWebdavLockRequest::SCOPE_EXCLUSIVE ? 'exclusive' : 'shared')); $lockEntryElement->appendChild($xmlTool->createDomElement($dom, 'locktype'))->appendChild($xmlTool->createDomElement($dom, $lockEntry->lockScope === ezcWebdavLockRequest::TYPE_READ ? 'read' : 'write')); $lockEntryContentElements[] = $lockEntryElement; } return $lockEntryContentElements; }