[Pkg-owncloud-commits] [php-sabredav] 61/64: Fixed broken unittests.

David Prévot taffit at moszumanska.debian.org
Thu Dec 11 15:13:28 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag 2.2.0alpha1
in repository php-sabredav.

commit 75477b03d22c9a06954783edbe43ac3d3d6f33ff
Author: Evert Pot <me at evertpot.com>
Date:   Sat Dec 6 23:32:11 2014 -0500

    Fixed broken unittests.
---
 tests/Sabre/CalDAV/PluginTest.php                   | 3 ++-
 tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php | 4 +++-
 tests/Sabre/DAV/Auth/Backend/Mock.php               | 4 +---
 tests/Sabre/DAVServerTest.php                       | 4 ++--
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tests/Sabre/CalDAV/PluginTest.php b/tests/Sabre/CalDAV/PluginTest.php
index 343a5f6..40f6c5c 100644
--- a/tests/Sabre/CalDAV/PluginTest.php
+++ b/tests/Sabre/CalDAV/PluginTest.php
@@ -83,8 +83,9 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
 
         // Adding Auth plugin, and ensuring that we are logged in.
         $authBackend = new DAV\Auth\Backend\Mock();
-        $authBackend->defaultUser = 'user1';
+        $authBackend->setPrincipal('principals/user1');
         $authPlugin = new DAV\Auth\Plugin($authBackend, 'SabreDAV');
+        $authPlugin->beforeMethod(new \Sabre\HTTP\Request(), new \Sabre\HTTP\Response());
         $this->server->addPlugin($authPlugin);
 
         // This forces a login
diff --git a/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php b/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php
index cd2635c..64234c0 100644
--- a/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php
+++ b/tests/Sabre/CalDAV/Schedule/FreeBusyRequestTest.php
@@ -79,8 +79,10 @@ END:VCALENDAR',
         $this->server->addPlugin($this->aclPlugin);
 
         $authBackend = new DAV\Auth\Backend\Mock();
-        $authBackend->setCurrentUser('user1');
+        $authBackend->setPrincipal('principals/user1');
         $this->authPlugin = new DAV\Auth\Plugin($authBackend,'SabreDAV');
+        // Forcing authentication to work.
+        $this->authPlugin->beforeMethod($this->request, $this->response);
         $this->server->addPlugin($this->authPlugin);
 
         // CalDAV plugin
diff --git a/tests/Sabre/DAV/Auth/Backend/Mock.php b/tests/Sabre/DAV/Auth/Backend/Mock.php
index 9eaff69..a103b83 100644
--- a/tests/Sabre/DAV/Auth/Backend/Mock.php
+++ b/tests/Sabre/DAV/Auth/Backend/Mock.php
@@ -13,8 +13,7 @@ class Mock implements BackendInterface {
 
     public $invalidCheckResponse = false;
 
-    public $principal;
-    public $defaultPrincipal = 'principals/admin';
+    public $principal = 'principals/admin';
 
     function setPrincipal($principal) {
 
@@ -58,7 +57,6 @@ class Mock implements BackendInterface {
         if ($this->fail) {
             return [false, "fail!"];
         }
-        $this->principal = $this->defaultPrincipal;
         return [true, $this->principal];
 
     }
diff --git a/tests/Sabre/DAVServerTest.php b/tests/Sabre/DAVServerTest.php
index 5d4ac79..c613ffe 100644
--- a/tests/Sabre/DAVServerTest.php
+++ b/tests/Sabre/DAVServerTest.php
@@ -133,8 +133,8 @@ abstract class DAVServerTest extends \PHPUnit_Framework_TestCase {
         }
         if ($this->autoLogin) {
             $authBackend = new DAV\Auth\Backend\Mock();
-            $authBackend->defaultUser = $this->autoLogin;
-            $this->authPlugin = new DAV\Auth\Plugin($authBackend, 'SabreDAV');
+            $authBackend->setPrincipal('principals/' . $this->autoLogin);
+            $this->authPlugin = new DAV\Auth\Plugin($authBackend);
             $this->server->addPlugin($this->authPlugin);
 
             // This will trigger the actual login procedure

-- 
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