[Pkg-owncloud-commits] [php-sabredav] 20/33: Added the TIMEOUT_INFINITE constant. I suppose this was just forgotten in the past.
David Prévot
taffit at moszumanska.debian.org
Sat Nov 30 15:43:55 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag version-1.0.10
in repository php-sabredav.
commit bc64afcd57c39bc899d211eb644cb6138b776702
Author: Evert Pot <evert at rooftopsolutions.nl>
Date: Tue Mar 16 10:59:27 2010 +0900
Added the TIMEOUT_INFINITE constant. I suppose this was just forgotten in the past.
Fixes Issue 29.
---
lib/Sabre/DAV/Locks/LockInfo.php | 5 ++++
lib/Sabre/DAV/Locks/Plugin.php | 2 +-
tests/Sabre/DAV/Locks/PluginTest.php | 46 ++++++++++++++++++++++++++++++++++++
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/lib/Sabre/DAV/Locks/LockInfo.php b/lib/Sabre/DAV/Locks/LockInfo.php
index 9855243..3639230 100644
--- a/lib/Sabre/DAV/Locks/LockInfo.php
+++ b/lib/Sabre/DAV/Locks/LockInfo.php
@@ -26,6 +26,11 @@ class Sabre_DAV_Locks_LockInfo {
const EXCLUSIVE = 2;
/**
+ * A never expiring timeout
+ */
+ const TIMEOUT_INFINITE = -1;
+
+ /**
* The owner of the lock
*
* @var string
diff --git a/lib/Sabre/DAV/Locks/Plugin.php b/lib/Sabre/DAV/Locks/Plugin.php
index 9a8daee..53c0f66 100644
--- a/lib/Sabre/DAV/Locks/Plugin.php
+++ b/lib/Sabre/DAV/Locks/Plugin.php
@@ -409,7 +409,7 @@ class Sabre_DAV_Locks_Plugin extends Sabre_DAV_ServerPlugin {
*
* @return int
*/
- protected function getTimeoutHeader() {
+ public function getTimeoutHeader() {
$header = $this->server->httpRequest->getHeader('Timeout');
diff --git a/tests/Sabre/DAV/Locks/PluginTest.php b/tests/Sabre/DAV/Locks/PluginTest.php
index 6b07664..e5f6acb 100644
--- a/tests/Sabre/DAV/Locks/PluginTest.php
+++ b/tests/Sabre/DAV/Locks/PluginTest.php
@@ -355,5 +355,51 @@ class Sabre_DAV_Locks_PluginTest extends Sabre_DAV_AbstractServer {
}
+ function testGetTimeoutHeader() {
+ $request = new Sabre_HTTP_Request(array(
+ 'HTTP_TIMEOUT' => 'second-100',
+ ));
+
+ $this->server->httpRequest = $request;
+ $this->assertEquals(100, $this->locksPlugin->getTimeoutHeader());
+
+ }
+
+
+ function testGetTimeoutHeaderNotSet() {
+
+ $request = new Sabre_HTTP_Request(array(
+ ));
+
+ $this->server->httpRequest = $request;
+ $this->assertEquals(0, $this->locksPlugin->getTimeoutHeader());
+
+ }
+
+
+ function testGetTimeoutHeaderInfinite() {
+
+ $request = new Sabre_HTTP_Request(array(
+ 'HTTP_TIMEOUT' => 'infinite',
+ ));
+
+ $this->server->httpRequest = $request;
+ $this->assertEquals(Sabre_DAV_Locks_LockInfo::TIMEOUT_INFINITE, $this->locksPlugin->getTimeoutHeader());
+
+ }
+
+ /**
+ * @expectedException Sabre_DAV_Exception_BadRequest
+ */
+ function testGetTimeoutHeaderInvalid() {
+
+ $request = new Sabre_HTTP_Request(array(
+ 'HTTP_TIMEOUT' => 'yourmom',
+ ));
+
+ $this->server->httpRequest = $request;
+ $this->locksPlugin->getTimeoutHeader();
+
+ }
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/php-sabredav.git
More information about the Pkg-owncloud-commits
mailing list