assertEquals('path',$href->getHref());
}
function testSerialize() {
$href = new Sabre_DAV_Property_Href('path');
$this->assertEquals('path',$href->getHref());
$doc = new DOMDocument();
$root = $doc->createElement('d:anything');
$root->setAttribute('xmlns:d','DAV:');
$doc->appendChild($root);
$server = new Sabre_DAV_Server();
$server->setBaseUri('/bla/');
$href->serialize($server, $root);
$xml = $doc->saveXML();
$this->assertEquals(
'
/bla/path
', $xml);
}
function testSerializeNoPrefix() {
$href = new Sabre_DAV_Property_Href('path',false);
$this->assertEquals('path',$href->getHref());
$doc = new DOMDocument();
$root = $doc->createElement('d:anything');
$root->setAttribute('xmlns:d','DAV:');
$doc->appendChild($root);
$server = new Sabre_DAV_Server();
$server->setBaseUri('/bla/');
$href->serialize($server, $root);
$xml = $doc->saveXML();
$this->assertEquals(
'
path
', $xml);
}
function testUnserialize() {
$xml = '
/bla/path
';
$dom = new DOMDocument();
$dom->loadXML($xml);
$href = Sabre_DAV_Property_Href::unserialize($dom->firstChild);
$this->assertEquals('/bla/path',$href->getHref());
}
function testUnserializeIncompatible() {
$xml = '
/bla/path
';
$dom = new DOMDocument();
$dom->loadXML($xml);
$href = Sabre_DAV_Property_Href::unserialize($dom->firstChild);
$this->assertNull($href);
}
}