parseUriToPath( $_SERVER['REQUEST_URI'] ); $this->fail( 'ezcWebdavMissingServerVariableException expected.' ); } catch ( ezcWebdavMissingServerVariableException $e ) {} } public function testPathDispatchingWithoutDocumentRoot() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = null; $_SERVER['REQUEST_URI'] = '/webdav.php/collection/ressource'; try { $factory = new ezcWebdavAutomaticPathFactory(); $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ); $this->fail( 'ezcWebdavMissingServerVariableException expected.' ); } catch ( ezcWebdavMissingServerVariableException $e ) {} } public function testRootPathWithoutRewrite() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs/'; $_SERVER['REQUEST_URI'] = '/webdav.php/collection/ressource'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/collection/ressource', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testRootPathWithoutRewriteDocrootMissingTrailingSlash() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs'; $_SERVER['REQUEST_URI'] = '/webdav.php/collection/ressource'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/collection/ressource', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testRootPathWithoutRewriteWebdavRoot() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs/'; $_SERVER['REQUEST_URI'] = '/webdav.php'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testRootPathWithoutRewriteWebdavRootSlash() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs/'; $_SERVER['REQUEST_URI'] = '/webdav.php/'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testSubDirWithoutRewrite() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/path/to/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs/'; $_SERVER['REQUEST_URI'] = '/path/to/webdav.php/collection/ressource'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/collection/ressource', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testSubDirWithoutRewriteDocrootMissingTrailingSlash() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/path/to/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs'; $_SERVER['REQUEST_URI'] = '/path/to/webdav.php/collection/ressource'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/collection/ressource', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testSubDirWithoutRewriteWebdavRoot() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/path/to/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs/'; $_SERVER['REQUEST_URI'] = '/path/to/webdav.php'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testSubDirWithoutRewriteWebdavRootSlash() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/path/to/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs/'; $_SERVER['REQUEST_URI'] = '/path/to/webdav.php/'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertSame( '/', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } public function testDispatchingWithRewrittenUri() { $_SERVER['SCRIPT_FILENAME'] = '/var/www/webdav/htdocs/path/to/webdav.php'; $_SERVER['DOCUMENT_ROOT'] = '/var/www/webdav/htdocs/'; $_SERVER['REQUEST_URI'] = '/path/to/webdav/collection/ressource'; $factory = new ezcWebdavAutomaticPathFactory(); $this->assertEquals( '/webdav/collection/ressource', $factory->parseUriToPath( $_SERVER['REQUEST_URI'] ) ); } } ?>