3 require_once 'Sabre/DAV/AbstractServer.php';
5 class Sabre_DAV_ServerEventsTest extends Sabre_DAV_AbstractServer {
9 function testAfterBind() {
11 $this->server->subscribeEvent('afterBind',array($this,'afterBindHandler'));
12 $newPath = 'afterBind';
15 $this->server->createFile($newPath,'body');
16 $this->assertEquals($newPath, $this->tempPath);
20 function afterBindHandler($path) {
22 $this->tempPath = $path;
26 function testBeforeBindCancel() {
28 $this->server->subscribeEvent('beforeBind', array($this,'beforeBindCancelHandler'));
29 $this->assertFalse($this->server->createFile('bla','body'));
32 $req = new Sabre_HTTP_Request(array(
33 'REQUEST_METHOD' => 'PUT',
34 'REQUEST_URI' => '/foobar',
37 $this->server->httpRequest = $req;
38 $this->server->exec();
40 $this->assertEquals('',$this->server->httpResponse->status);
44 function beforeBindCancelHandler() {