mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 17:08:48 +00:00
Initial Release of the calendar plugin
This commit is contained in:
parent
45cc9885fc
commit
7115197a33
561 changed files with 189494 additions and 0 deletions
127
dav/SabreDAV/tests/Sabre/DAV/ServerUpdatePropertiesTest.php
Normal file
127
dav/SabreDAV/tests/Sabre/DAV/ServerUpdatePropertiesTest.php
Normal file
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
class Sabre_DAV_ServerUpdatePropertiesTest extends PHPUnit_Framework_TestCase {
|
||||
|
||||
function testUpdatePropertiesFail() {
|
||||
|
||||
$tree = array(
|
||||
new Sabre_DAV_SimpleCollection('foo'),
|
||||
);
|
||||
$server = new Sabre_DAV_Server($tree);
|
||||
|
||||
$result = $server->updateProperties('foo', array(
|
||||
'{DAV:}foo' => 'bar'
|
||||
));
|
||||
|
||||
$expected = array(
|
||||
'href' => 'foo',
|
||||
'403' => array(
|
||||
'{DAV:}foo' => null,
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
function testUpdatePropertiesProtected() {
|
||||
|
||||
$tree = array(
|
||||
new Sabre_DAV_SimpleCollection('foo'),
|
||||
);
|
||||
$server = new Sabre_DAV_Server($tree);
|
||||
|
||||
$result = $server->updateProperties('foo', array(
|
||||
'{DAV:}getetag' => 'bla',
|
||||
'{DAV:}foo' => 'bar'
|
||||
));
|
||||
|
||||
$expected = array(
|
||||
'href' => 'foo',
|
||||
'403' => array(
|
||||
'{DAV:}getetag' => null,
|
||||
),
|
||||
'424' => array(
|
||||
'{DAV:}foo' => null,
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
function testUpdatePropertiesEventFail() {
|
||||
|
||||
$tree = array(
|
||||
new Sabre_DAV_SimpleCollection('foo'),
|
||||
);
|
||||
$server = new Sabre_DAV_Server($tree);
|
||||
$server->subscribeEvent('updateProperties', array($this,'updatepropfail'));
|
||||
|
||||
$result = $server->updateProperties('foo', array(
|
||||
'{DAV:}foo' => 'bar',
|
||||
'{DAV:}foo2' => 'bla',
|
||||
));
|
||||
|
||||
$expected = array(
|
||||
'href' => 'foo',
|
||||
'404' => array(
|
||||
'{DAV:}foo' => null,
|
||||
),
|
||||
'424' => array(
|
||||
'{DAV:}foo2' => null,
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
function updatePropFail(&$propertyDelta, &$result, $node) {
|
||||
|
||||
$result[404] = array(
|
||||
'{DAV:}foo' => null,
|
||||
);
|
||||
unset($propertyDelta['{DAV:}foo']);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function testUpdatePropertiesEventSuccess() {
|
||||
|
||||
$tree = array(
|
||||
new Sabre_DAV_SimpleCollection('foo'),
|
||||
);
|
||||
$server = new Sabre_DAV_Server($tree);
|
||||
$server->subscribeEvent('updateProperties', array($this,'updatepropsuccess'));
|
||||
|
||||
$result = $server->updateProperties('foo', array(
|
||||
'{DAV:}foo' => 'bar',
|
||||
'{DAV:}foo2' => 'bla',
|
||||
));
|
||||
|
||||
$expected = array(
|
||||
'href' => 'foo',
|
||||
'200' => array(
|
||||
'{DAV:}foo' => null,
|
||||
),
|
||||
'201' => array(
|
||||
'{DAV:}foo2' => null,
|
||||
),
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
}
|
||||
|
||||
function updatePropSuccess(&$propertyDelta, &$result, $node) {
|
||||
|
||||
$result[200] = array(
|
||||
'{DAV:}foo' => null,
|
||||
);
|
||||
$result[201] = array(
|
||||
'{DAV:}foo2' => null,
|
||||
);
|
||||
unset($propertyDelta['{DAV:}foo']);
|
||||
unset($propertyDelta['{DAV:}foo2']);
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue