public function setUp() { $_SERVER['REQUEST_METHOD'] = 'UNKNOWN'; $this->obj = DAV_Request::inst(); DAV::$REGISTRY = new DAV_Test_Registry(); DAV::$REGISTRY->setResourceClass('DAVACL_Test_Resource'); }
public function setUp() { $_SERVER['REQUEST_METHOD'] = 'MKCOL'; $this->obj = DAV_Request::inst(); DAV::$REGISTRY = new DAV_Test_Registry(); DAV::$REGISTRY->setResourceClass('DAV_Resource'); DAV::$LOCKPROVIDER = null; }
public function setUp() { $_SERVER['REQUEST_METHOD'] = 'COPY'; $_SERVER['HTTP_DEPTH'] = 'infinity'; $_SERVER['HTTP_DESTINATION'] = '/new/destination'; DAV::$REGISTRY = new DAV_Test_Registry(); DAV::$REGISTRY->setResourceClass('DAVACL_Test_Resource'); $this->obj = DAV_Request::inst(); }
public function setUp() { $_SERVER['REQUEST_METHOD'] = 'DELETE'; $_SERVER['HTTP_DEPTH'] = 'infinity'; $_SERVER['REQUEST_URI'] = '/path/to/resource'; DAV::$REGISTRY = new DAV_Test_Registry(); DAV::$REGISTRY->setResourceClass('DAVACL_Test_Resource'); dav::$LOCKPROVIDER = new DAV_Test_Lock_Provider(); $this->obj = DAV_Request::inst(); }
public function testHandleWrongLock() { $_SERVER['HTTP_LOCK_TOKEN'] = '<urn:uuid:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa>'; $this->obj = DAV_Request::inst(); $this->expectOutputString(<<<EOS Content-Type: application/xml; charset="UTF-8" HTTP/1.1 409 Conflict <?xml version="1.0" encoding="utf-8"?> <D:error xmlns:D="DAV:"> <D:lock-token-matches-request-uri/> </D:error> EOS ); $this->obj->handleRequest(); }
public function setUp() { $_SERVER['REQUEST_METHOD'] = 'HEAD'; $headers = array(); $headers['Content-Length'] = 100; $headers['Content-Type'] = 'text/plain'; $headers['ETag'] = 'an ETag'; $headers['Last-Modified'] = '11-12-13 14:15'; $headers['Content-Language'] = 'nl'; $headers['Accept-Ranges'] = 'bytes'; $resource = $this->getMock('DAVACL_Test_Resource', array('method_HEAD'), array($_SERVER['REQUEST_URI'])); $resource->expects($this->once())->method('method_HEAD')->will($this->returnValue($headers)); DAV::$REGISTRY = new DAV_Test_Registry(); DAV::$REGISTRY->setResourceClass($resource); $this->obj = DAV_Request::inst(); }
public function testHandle() { $_SERVER['REQUEST_METHOD'] = 'OPTIONS'; $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'] = 'LOCK'; $_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'] = 'Depth'; $obj = DAV_Request::inst(); $this->expectOutputString(<<<EOS DAV: 1, 3 DAV: access-control DAV: <http://apache.org/dav/propset/fs/1> MS-Author-Via: DAV Allow: ACL, COPY, DELETE, GET, HEAD, LOCK, MKCOL, MOVE, OPTIONS, POST, PROPFIND, PROPPATCH, PUT, REPORT, UNLOCK Content-Length: 0 Access-Control-Allow-Methods: LOCK Access-Control-Allow-Headers: Depth EOS ); $obj->handleRequest(); }
public function testInst() { $this->assertInstanceOf('DAV_Request_PROPFIND', DAV_Request::inst(), 'DAV_Request::inst() should return an instance of the correct class'); }
public function testHandleWithRange() { // Check with range $map = array(array('/collection/new_resource', new DAVACL_Test_Resource('/collection/new_resource')), array('/collection', new DAVACL_Test_Collection('/collection'))); DAV::$REGISTRY = $this->getMock('DAV_Test_Registry', array('resource')); DAV::$REGISTRY->expects($this->any())->method('resource')->will($this->returnValueMap($map)); $this->expectOutputString(<<<EOS DAVACL_Test_Resource::method_PUT_range() called for /collection/new_resource HTTP/1.1 204 No Content EOS ); $_SERVER['HTTP_CONTENT_RANGE'] = 'bytes 500-999/1234'; $this->obj = DAV_Request::inst(); $this->obj->handleRequest(); }
* * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @package BeeHub */ // Bootstrap the application require_once '../src/beehub_bootstrap.php'; $config = BeeHub::config(); if (@$config['install']['run_install'] === 'true') { require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR . 'webserver_install.php'; exit; } // If a GET request on the root doesn't have this server as a referer, redirect to the homepage: if (!isset($_GET['nosystem']) && DAV::getPath() === '/' && $_SERVER['REQUEST_METHOD'] === 'GET' && (!isset($_SERVER['HTTP_REFERER']) || $_SERVER['SERVER_NAME'] !== parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST))) { DAV::redirect(DAV::HTTP_SEE_OTHER, BeeHub::SYSTEM_PATH); return; } // After bootstrapping, start authentication if (APPLICATION_ENV === BeeHub::ENVIRONMENT_TEST || !empty($_SERVER['HTTPS'])) { BeeHub_Auth::inst()->handle_authentication(BeeHub_Auth::is_authentication_required()); } // And finally handle the request $request = DAV_Request::inst(); if ($request) { $request->handleRequest(); } // End of file