7 require_once
'Sabre/DAV/AbstractServer.php';
17 $this->server->on(
'afterBind', [$this,
'afterBindHandler']);
18 $newPath =
'afterBind';
21 $this->server->createFile($newPath,
'body');
22 $this->assertEquals($newPath, $this->tempPath);
28 $this->tempPath =
$path;
34 $mock = $this->getMockBuilder(
'stdClass')
35 ->setMethods([
'afterResponseCallback'])
37 $mock->expects($this->
once())->method(
'afterResponseCallback');
39 $this->server->on(
'afterResponse', [$mock,
'afterResponseCallback']);
42 'REQUEST_METHOD' =>
'GET',
43 'REQUEST_URI' =>
'/test.txt',
46 $this->server->exec();
52 $this->server->on(
'beforeBind', [$this,
'beforeBindCancelHandler']);
53 $this->assertFalse($this->server->createFile(
'bla',
'body'));
57 'REQUEST_METHOD' =>
'PUT',
58 'REQUEST_URI' =>
'/barbar',
61 $this->server->httpRequest =
$req;
62 $this->server->exec();
64 $this->assertEquals(500, $this->server->httpResponse->getStatus());
76 $this->server->on(
'exception', [$this,
'exceptionHandler']);
79 'REQUEST_METHOD' =>
'GET',
80 'REQUEST_URI' =>
'/not/exisitng',
82 $this->server->httpRequest =
$req;
83 $this->server->exec();
85 $this->assertInstanceOf(
'Sabre\\DAV\\Exception\\NotFound', $this->exception);
114 $this->server->invokeMethod(
122 $this->assertTrue($k >= 2 && $k <= 3);
The Request class represents a single HTTP request.
beforeBindCancelHandler($path)
This class represents a single HTTP response.
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
exceptionHandler(Exception $exception)
static createFromServerArray(array $serverArray)
This static method will create a new Request object, based on a PHP $_SERVER array.