xref: /plugin/davcal/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php (revision a1a3b6794e0e143a4a8b51d3185ce2d339be61ab)
1*a1a3b679SAndreas Boehler<?php
2*a1a3b679SAndreas Boehler
3*a1a3b679SAndreas Boehlernamespace Sabre\DAV;
4*a1a3b679SAndreas Boehler
5*a1a3b679SAndreas Boehleruse
6*a1a3b679SAndreas Boehler    Sabre\HTTP\RequestInterface,
7*a1a3b679SAndreas Boehler    Sabre\HTTP\ResponseInterface;
8*a1a3b679SAndreas Boehler
9*a1a3b679SAndreas Boehlerclass TestPlugin extends ServerPlugin {
10*a1a3b679SAndreas Boehler
11*a1a3b679SAndreas Boehler    public $beforeMethod;
12*a1a3b679SAndreas Boehler
13*a1a3b679SAndreas Boehler    function getFeatures() {
14*a1a3b679SAndreas Boehler
15*a1a3b679SAndreas Boehler        return ['drinking'];
16*a1a3b679SAndreas Boehler
17*a1a3b679SAndreas Boehler    }
18*a1a3b679SAndreas Boehler
19*a1a3b679SAndreas Boehler    function getHTTPMethods($uri) {
20*a1a3b679SAndreas Boehler
21*a1a3b679SAndreas Boehler        return ['BEER','WINE'];
22*a1a3b679SAndreas Boehler
23*a1a3b679SAndreas Boehler    }
24*a1a3b679SAndreas Boehler
25*a1a3b679SAndreas Boehler    function initialize(Server $server) {
26*a1a3b679SAndreas Boehler
27*a1a3b679SAndreas Boehler        $server->on('beforeMethod', [$this,'beforeMethod']);
28*a1a3b679SAndreas Boehler
29*a1a3b679SAndreas Boehler    }
30*a1a3b679SAndreas Boehler
31*a1a3b679SAndreas Boehler    function beforeMethod(RequestInterface $request, ResponseInterface $response) {
32*a1a3b679SAndreas Boehler
33*a1a3b679SAndreas Boehler        $this->beforeMethod = $request->getMethod();
34*a1a3b679SAndreas Boehler        return true;
35*a1a3b679SAndreas Boehler
36*a1a3b679SAndreas Boehler    }
37*a1a3b679SAndreas Boehler
38*a1a3b679SAndreas Boehler}
39