Author: ts
Date: Wed Sep 19 15:59:11 2007
New Revision: 6202

Log:
- Added UNLOCK request.

Added:
    trunk/Webdav/src/request/unlock.php   (with props)
    trunk/Webdav/tests/request_unlock_test.php   (with props)
Modified:
    trunk/Webdav/design/class_diagram.png
    trunk/Webdav/src/webdav_autoload.php
    trunk/Webdav/tests/suite.php

Modified: trunk/Webdav/design/class_diagram.png
==============================================================================
Binary files - no diff available.

Added: trunk/Webdav/src/request/unlock.php
==============================================================================
--- trunk/Webdav/src/request/unlock.php (added)
+++ trunk/Webdav/src/request/unlock.php [iso-8859-1] Wed Sep 19 15:59:11 2007
@@ -1,0 +1,67 @@
+<?php
+/**
+ * File containing the ezcWebdavUnlockRequest class.
+ *
+ * @package Webdav
+ * @version //autogentag//
+ * @copyright Unlockright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+/**
+ * Request class generated by a LOCK request.
+ * This request represents the WebDAV LOCK action.
+ *
+ * An object of this class may have 1 of 3 possible properties used. If none is
+ * used, it must be asumed that the [EMAIL PROTECTED] $allProp} property is 
set to true.
+ *
+ * The [EMAIL PROTECTED] $allProp} property indicates, that a list of all 
available
+ * properties is required, including the value of each property.
+ * In contrast, the [EMAIL PROTECTED] $propName} property indicates, that only 
a list of
+ * property names, without property values, is requested. The [EMAIL 
PROTECTED] $prop}
+ * property is of type array (or null, if not set) and can contain a list of
+ * property names, which are requested to be returned, including their values.
+ *
+ * Optional headers for this request are:
+ * - Depth (default: ezcWebdavRequest::DEPTH_INFINITY)
+ * 
+ * @package Webdav
+ * @version //autogen//
+ * @copyright Unlockright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @author  
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ *
+ * @property bool $allProp
+ *           Representing the <allprop /> XML element.
+ * @property bool $propName 
+ *           Representing the <propname /> XML element. 
+ * @property array(string) $prop
+ *           Representing the <prop /> XML element. Can contain a list of
+ *           property names.
+ */
+class ezcWebdavUnlockRequest extends ezcWebdavRequest
+{
+    /**
+     * Validates the headers set in this request.
+     * This method validates that all required headers are available and that
+     * all feasible headers for this request have valid values.
+     *
+     * @return void
+     *
+     * @throws ezcWebdavMissingHeaderException
+     *         if a required header is missing.
+     * @throws ezcWebdavInvalidHeaderException
+     *         if a header is present, but its content does not validate.
+     */
+    public function validateHeaders()
+    {
+        if ( isset( $this->headers['Lock-Token'] ) === false )
+        {
+            throw new ezcWebdavMissingHeaderException( 'Lock-Token' );
+        }
+
+        // Validate common HTTP/WebDAV headers
+        parent::validateHeaders();
+    }
+}
+
+?>

Propchange: trunk/Webdav/src/request/unlock.php
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/Webdav/src/webdav_autoload.php
==============================================================================
--- trunk/Webdav/src/webdav_autoload.php [iso-8859-1] (original)
+++ trunk/Webdav/src/webdav_autoload.php [iso-8859-1] Wed Sep 19 15:59:11 2007
@@ -82,5 +82,6 @@
     'ezcWebdavSourcePropertyLink'              => 
'Webdav/properties/source_link.php',
     'ezcWebdavSupportedLockProperty'           => 
'Webdav/properties/supportedlock.php',
     'ezcWebdavTransport'                       => 'Webdav/transport.php',
+    'ezcWebdavUnlockRequest'                   => 'Webdav/request/unlock.php',
 );
 ?>

Added: trunk/Webdav/tests/request_unlock_test.php
==============================================================================
--- trunk/Webdav/tests/request_unlock_test.php (added)
+++ trunk/Webdav/tests/request_unlock_test.php [iso-8859-1] Wed Sep 19 15:59:11 
2007
@@ -1,0 +1,67 @@
+<?php
+/**
+ * File containing the ezcWebdavUnlockRequestTest class.
+ *
+ * @package Webdav
+ * @subpackage Tests
+ * @version //autogentag//
+ * @copyright Unlockright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+
+/**
+ * Reqiuire base test
+ */
+require_once 'request_test.php';
+
+/**
+ * Test case for the ezcWebdavUnlockRequest class.
+ * 
+ * @package Webdav
+ * @subpackage Tests
+ * @version //autogentag//
+ * @copyright Unlockright (C) 2005-2007 eZ systems as. All rights reserved.
+ * @license http://ez.no/licenses/new_bsd New BSD License
+ */
+class ezcWebdavUnlockRequestTest extends ezcWebdavRequestTestCase
+{
+    public static function suite()
+    {
+               return new PHPUnit_Framework_TestSuite( __CLASS__ );
+    }
+
+    protected function setUp()
+    {
+        $this->className = 'ezcWebdavUnlockRequest';
+        $this->constructorArguments = array(
+            '/foo', '/bar'
+        );
+        $this->defaultValues = array(
+        );
+        $this->workingValues = array(
+        );
+        $this->failingValues = array(
+        );
+    }
+
+    public function testValidateHeadersSuccess()
+    {
+        $req = new ezcWebdavUnlockRequest( '/foo', '/bar' );
+        $req->setHeader( 'Lock-Token', 
'<opaquelocktoken:a515cfa4-5da4-22e1-f5b5-00a0451e6bf7>' );
+        $req->validateHeaders();
+    }
+
+    public function testValidateHeadersFailure()
+    {
+        $req = new ezcWebdavUnlockRequest( '/foo', '/bar' );
+        
+        try
+        {
+            $req->validateHeaders();
+            $this->fail( 'Exception not thrown on missing Unlock-Token 
header.' );
+        }
+        catch ( ezcWebdavMissingHeaderException $e ) {}
+    }
+}
+
+?>

Propchange: trunk/Webdav/tests/request_unlock_test.php
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/Webdav/tests/suite.php
==============================================================================
--- trunk/Webdav/tests/suite.php [iso-8859-1] (original)
+++ trunk/Webdav/tests/suite.php [iso-8859-1] Wed Sep 19 15:59:11 2007
@@ -47,6 +47,7 @@
 require_once 'request_propfind_test.php';
 require_once 'request_proppatch_test.php';
 require_once 'request_lock_test.php';
+require_once 'request_unlock_test.php';
 
 require_once 'request_content_property_behaviour_test.php';
 
@@ -104,6 +105,7 @@
         $this->addTest( ezcWebdavMoveRequestTest::suite() );
         $this->addTest( ezcWebdavPropFindRequestTest::suite() );
         $this->addTest( ezcWebdavPropPatchRequestTest::suite() );
+        $this->addTest( ezcWebdavUnlockRequestTest::suite() );
         $this->addTest( ezcWebdavRequestPropertyBehaviourContentTest::suite() 
);
         
         $this->addTest( ezcWebdavErrorResonseTest::suite() );


-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to