Added the Interfaces package.
authorGunnar Wrobel <p@rdus.de>
Mon, 30 Aug 2010 07:12:59 +0000 (09:12 +0200)
committerGunnar Wrobel <p@rdus.de>
Mon, 30 Aug 2010 07:12:59 +0000 (09:12 +0200)
Rationale:

When looking at the Kolab_Session package I realized that
"Horde_Auth::getAuth()" calls have been converted to
"$GLOBALS['registry']->getAuth()". While this may be fine on the
application level I don't think it is acceptable on the level of a
framework package.

"$GLOBALS['registry']->getAuth()" does pretty much the same as
"Horde_Auth::getAuth()" did before and the move of the functionality
into the registry is absolutely fine.

For Kolab_Session this does however mean that the dependency on that
functionality gets further obscured. Something has to setup
$GLOBALS['registry'] before Kolab_Session is called into the mix.

At the same time I think the package would now need to pull in Core as
a dependency which I wouldn't like much either.

I think it is a cleaner solution to provide the Interfaces package. It
can be used to clearly define the communications between Core and the
other framework packages. This also allows to declare the dependencies
in an obvious manner and decouples low level libraries from the BIG
Core thing.

20 files changed:
framework/Core/lib/Horde/Registry.php
framework/Core/package.xml
framework/Interfaces/lib/Horde/Interfaces/Registry/Auth.php [new file with mode: 0644]
framework/Interfaces/package.xml [new file with mode: 0644]
framework/Kolab_Session/lib/Horde/Kolab/Session.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php [deleted file]
framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Mock.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Base.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Decorator/Anonymous.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Base.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Decorator/Logged.php
framework/Kolab_Session/lib/Horde/Kolab/Session/Valid/Interface.php
framework/Kolab_Session/package.xml
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Auth/HordeTest.php [deleted file]
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Auth/MockTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/BaseTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Class/Valid/Decorator/LoggedTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/Integration/ValidTest.php
framework/Kolab_Session/test/Horde/Kolab/Session/SessionTestCase.php

index 86f771b..16cd295 100644 (file)
@@ -17,6 +17,7 @@
  * @package  Core
  */
 class Horde_Registry
+implements Horde_Interfaces_Registry_Auth
 {
     /* Session flags. */
     const SESSION_NONE = 1;
index 88fad1a..69926c5 100644 (file)
@@ -286,6 +286,10 @@ Application Framework.</description>
     <channel>pear.horde.org</channel>
    </package>
    <package>
+    <name>Interfaces</name>
+    <channel>pear.horde.org</channel>
+   </package>
+   <package>
     <name>Injector</name>
     <channel>pear.horde.org</channel>
    </package>
diff --git a/framework/Interfaces/lib/Horde/Interfaces/Registry/Auth.php b/framework/Interfaces/lib/Horde/Interfaces/Registry/Auth.php
new file mode 100644 (file)
index 0000000..7ff0b62
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+/**
+ * Defines a provider of authentication information.
+ *
+ * PHP version 5
+ *
+ * @category Horde
+ * @package  Interfaces
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Interfaces
+ */
+
+/**
+ * Defines a provider of authentication information.
+ *
+ * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
+ *
+ * See the enclosed file COPYING for license information (LGPL). If you
+ * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
+ *
+ * @category Horde
+ * @package  Interfaces
+ * @author   Gunnar Wrobel <wrobel@pardus.de>
+ * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
+ * @link     http://pear.horde.org/index.php?package=Interfaces
+ */
+interface Horde_Interfaces_Registry_Auth
+{
+    /**
+     * Returns the currently logged in user, if there is one.
+     *
+     * @param string $format  The return format, defaults to the unique Horde
+     *                        ID. Alternative formats:
+     *                        - bare: Horde ID without any domain information
+     *                          (e.g., foo@example.com would be returned as
+     *                          'foo').
+     *                        - domain: Domain of the Horde ID (e.g.,
+     *                          foo@example.com would be returned as
+     *                          'example.com').
+     *                        - original: The username used to originally login
+     *                          to Horde.
+     *
+     * @return mixed  The user ID or false if no user is logged in.
+     */
+    public function getAuth($format = null);
+}
diff --git a/framework/Interfaces/package.xml b/framework/Interfaces/package.xml
new file mode 100644 (file)
index 0000000..7e639ad
--- /dev/null
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.4.9" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Interfaces</name>
+ <channel>pear.horde.org</channel>
+ <summary>A collection of Horde specific interfaces.</summary>
+ <description>This package provides the interfaces that are required for the communication between framework packages and the core application infrastructure of Horde. The main provider of implementations found in this package will be the Horde Core framework package.
+ </description>
+ <lead>
+  <name>Gunnar Wrobel</name>
+  <user>wrobel</user>
+  <email>p@rdus.de</email>
+  <active>yes</active>
+ </lead>
+ <lead>
+  <name>Chuck Hagenbuch</name>
+  <user>chuck</user>
+  <email>chuck@horde.org</email>
+  <active>yes</active>
+ </lead>
+ <lead>
+  <name>Jan Schneider</name>
+  <user>jan</user>
+  <email>jan@horde.org</email>
+  <active>yes</active>
+ </lead>
+ <date>2009-03-02</date>
+ <version>
+  <release>0.0.1</release>
+  <api>0.0.1</api>
+ </version>
+ <stability>
+  <release>alpha</release>
+  <api>alpha</api>
+ </stability>
+ <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
+ <notes>
+  * Initial package.
+ </notes>
+ <contents>
+  <dir name="/">
+   <dir name="lib">
+    <dir name="Horde">
+     <dir name="Interfaces">
+      <dir name="Registry">
+       <file name="Auth.php" role="php" />
+      </dir> <!-- /lib/Horde/Session -->
+     </dir> <!-- /lib/Horde/Kolab -->
+    </dir> <!-- /lib/Horde -->
+   </dir> <!-- /lib -->
+  </dir> <!-- / -->
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>4.3.0</min>
+   </php>
+   <pearinstaller>
+    <min>1.4.0b1</min>
+   </pearinstaller>
+  </required>
+ </dependencies>
+ <phprelease>
+  <filelist>
+   <install name="lib/Horde/Interfaces/Registry/Auth.php" as="Horde/Interfaces/Registry/Auth.php" />
+  </filelist>
+ </phprelease>
+ <changelog>
+ </changelog>
+</package>
index 4a1e778..c5b9952 100644 (file)
  * information in the Kolab session handler as reading this data is expensive
  * and it is sufficient to read it once per session.
  *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
+ * The users account id needs to be provided from the outside via an instance of
+ * Horde_Interfaces_Registry_Auth::. Any additional Kolab user data relevant for
+ * the user session should be accessed via the Horde_Kolab_Session class.
  *
  * Copyright 2008-2010 The Horde Project (http://www.horde.org/)
  *
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Horde.php
deleted file mode 100644 (file)
index d9e22c3..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Wraps Horde authentication for the Kolab session information.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Wraps Horde authentication for the Kolab session information.
- *
- * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-class Horde_Kolab_Session_Auth_Horde
-implements Horde_Kolab_Session_Auth_Interface
-{
-    /**
-     * Get the current user ID.
-     *
-     * @return string The ID of the current user.
-     */
-    public function getCurrentUser()
-    {
-        return $GLOBALS['registry']->getAuth();
-    }
-}
diff --git a/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php b/framework/Kolab_Session/lib/Horde/Kolab/Session/Auth/Interface.php
deleted file mode 100644 (file)
index a859647..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Defines an authentication wrapper for the Kolab session information.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Defines an authentication wrapper for the Kolab session information.
- *
- * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-interface Horde_Kolab_Session_Auth_Interface
-{
-    /**
-     * Get the current user ID.
-     *
-     * @return string The ID of the current user.
-     */
-    public function getCurrentUser();
-}
index 379a35d..8617311 100644 (file)
@@ -26,7 +26,7 @@
  * @link     http://pear.horde.org/index.php?package=Kolab_Session
  */
 class Horde_Kolab_Session_Auth_Mock
-implements Horde_Kolab_Session_Auth_Interface
+implements Horde_Interfaces_Registry_Auth
 {
     /**
      * The user this instance will report.
@@ -46,12 +46,42 @@ implements Horde_Kolab_Session_Auth_Interface
     }
 
     /**
-     * Get the current user ID.
+     * Returns the currently logged in user, if there is one.
      *
-     * @return string The ID of the current user.
+     * @param string $format  The return format, defaults to the unique Horde
+     *                        ID. Alternative formats:
+     *                        - bare: Horde ID without any domain information
+     *                          (e.g., foo@example.com would be returned as
+     *                          'foo').
+     *                        - domain: Domain of the Horde ID (e.g.,
+     *                          foo@example.com would be returned as
+     *                          'example.com').
+     *                        - original: The username used to originally login
+     *                          to Horde.
+     *
+     * @return mixed  The user ID or false if no user is logged in.
      */
-    public function getCurrentUser()
+    public function getAuth($format = null)
     {
-        return $this->_user;
+        if (empty($this->_user)) {
+            return false;
+        }
+
+        $user = $this->_user;
+
+        switch ($format) {
+        case 'bare':
+            return (($pos = strpos($user, '@')) === false)
+                ? $user
+                : substr($user, 0, $pos);
+
+        case 'domain':
+            return (($pos = strpos($user, '@')) === false)
+                ? false
+                : substr($user, $pos + 1);
+
+        default:
+            return $user;
+        }
     }
 }
index 7f5b67c..83b17e6 100644 (file)
 /**
  * The Horde_Kolab_Session class holds user details in the current session.
  *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
- *
  * Copyright 2008-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you
index a6e39bf..3f0abba 100644 (file)
  * The Horde_Kolab_Session_Anonymous class allows anonymous access to the Kolab
  * system.
  *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
- *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you
index 4b028c1..c251dca 100644 (file)
 /**
  * A class to check if the given session is valid.
  *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
- *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you
@@ -44,20 +38,20 @@ implements Horde_Kolab_Session_Valid_Interface
     /**
      * Provides authentication information for this object.
      *
-     * @var Horde_Kolab_Session_Auth_Interface
+     * @var Horde_Interfaces_Registry_Auth
      */
     private $_auth;
 
     /**
      * Constructor.
      *
-     * @param Horde_Kolab_Session                $session The session that should be
-     *                                                    validated.
-     * @param Horde_Kolab_Session_Auth_Interface $auth    The authentication handler.
+     * @param Horde_Kolab_Session            $session The session that should be
+     *                                                validated.
+     * @param Horde_Interfaces_Registry_Auth $auth    The authentication handler.
      */
     public function __construct(
         Horde_Kolab_Session $session,
-        Horde_Kolab_Session_Auth_Interface $auth
+        Horde_Interfaces_Registry_Auth $auth
     ) {
         $this->_session = $session;
         $this->_auth    = $auth;
@@ -75,7 +69,7 @@ implements Horde_Kolab_Session_Valid_Interface
     public function isValid($user = null)
     {
         $mail = $this->_session->getMail();
-        if ($this->_auth->getCurrentUser() != $mail) {
+        if ($this->_auth->getAuth() != $mail) {
             return false;
         }
         if (empty($user)) {
@@ -101,7 +95,7 @@ implements Horde_Kolab_Session_Valid_Interface
     /**
      * Return the auth driver of this validator.
      *
-     * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this
+     * @return Horde_Interfaces_Registry_Auth The auth driver set for this
      * validator.
      */
     public function getAuth()
index d30be05..0b5e8f0 100644 (file)
@@ -76,7 +76,7 @@ implements Horde_Kolab_Session_Valid_Interface
                 sprintf(
                     "Invalid Kolab session for current user \"%s\", requested"
                     . " user \"%s\" and stored user \"%s\".",
-                    $this->_valid->getAuth()->getCurrentUser(),
+                    $this->_valid->getAuth()->getAuth(),
                     $user,
                     $this->_valid->getSession()->getMail()
                 )
@@ -99,7 +99,7 @@ implements Horde_Kolab_Session_Valid_Interface
     /**
      * Return the auth driver of this validator.
      *
-     * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this
+     * @return Horde_Interfaces_Registry_Auth The auth driver set for this
      * validator.
      */
     public function getAuth()
index 7238752..0bbd02b 100644 (file)
 /**
  * Interface for session validators.
  *
- * The core user credentials (login, pass) are kept within the Auth module and
- * can be retrieved using <code>Auth::getAuth()</code> respectively
- * <code>Auth::getCredential('password')</code>. Any additional Kolab user data
- * relevant for the user session should be accessed via the Horde_Kolab_Session
- * class.
- *
  * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (LGPL). If you
@@ -55,7 +49,7 @@ interface Horde_Kolab_Session_Valid_Interface
     /**
      * Return the auth driver of this validator.
      *
-     * @return Horde_Kolab_Session_Auth_Interface The auth driver set for this
+     * @return Horde_Interfaces_Registry_Auth The auth driver set for this
      * validator.
      */
     public function getAuth();
index 4c0c306..1d16375 100644 (file)
@@ -48,8 +48,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
       <file name="Session.php" role="php" />
       <dir name="Session">
        <dir name="Auth">
-        <file name="Horde.php" role="php" />
-        <file name="Interface.php" role="php" />
         <file name="Mock.php" role="php" />
        </dir> <!-- /lib/Horde/Session/Auth -->
        <file name="Base.php" role="php" />
@@ -87,7 +85,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
        <file name="Autoload.php" role="test" />
        <dir name="Class">
         <dir name="Auth">
-         <file name="HordeTest.php" role="test" />
          <file name="MockTest.php" role="test" />
         </dir> <!-- /test/Horde/Kolab/Session/Class/Auth -->
         <file name="BaseTest.php" role="test" />
@@ -128,6 +125,10 @@ http://pear.php.net/dtd/package-2.0.xsd">
     <min>1.4.0b1</min>
    </pearinstaller>
    <package>
+    <name>Interfaces</name>
+    <channel>pear.horde.org</channel>
+   </package>
+   <package>
     <name>Kolab_Server</name>
     <channel>pear.horde.org</channel>
    </package>
@@ -138,14 +139,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
   </required>
   <optional>
    <package>
-    <name>Auth</name>
-    <channel>pear.horde.org</channel>
-   </package>
-   <package>
-    <name>Injector</name>
-    <channel>pear.horde.org</channel>
-   </package>
-   <package>
     <name>Log</name>
     <channel>pear.horde.org</channel>
    </package>
@@ -158,8 +151,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
  <phprelease>
   <filelist>
    <install name="lib/Horde/Kolab/Session.php" as="Horde/Kolab/Session.php" />
-   <install name="lib/Horde/Kolab/Session/Auth/Horde.php" as="Horde/Kolab/Session/Auth/Horde.php" />
-   <install name="lib/Horde/Kolab/Session/Auth/Interface.php" as="Horde/Kolab/Session/Auth/Interface.php" />
    <install name="lib/Horde/Kolab/Session/Auth/Mock.php" as="Horde/Kolab/Session/Auth/Mock.php" />
    <install name="lib/Horde/Kolab/Session/Base.php" as="Horde/Kolab/Session/Base.php" />
    <install name="lib/Horde/Kolab/Session/Exception.php" as="Horde/Kolab/Session/Exception.php" />
@@ -176,7 +167,6 @@ http://pear.php.net/dtd/package-2.0.xsd">
    <install name="lib/Horde/Kolab/Session/Valid/Interface.php" as="Horde/Kolab/Session/Valid/Interface.php" />
    <install name="test/Horde/Kolab/Session/AllTests.php" as="Horde/Kolab/Session/AllTests.php" />
    <install name="test/Horde/Kolab/Session/Autoload.php" as="Horde/Kolab/Session/Autoload.php" />
-   <install name="test/Horde/Kolab/Session/Class/Auth/HordeTest.php" as="Horde/Kolab/Session/Class/Auth/HordeTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Auth/MockTest.php" as="Horde/Kolab/Session/Class/Auth/MockTest.php" />
    <install name="test/Horde/Kolab/Session/Class/BaseTest.php" as="Horde/Kolab/Session/Class/BaseTest.php" />
    <install name="test/Horde/Kolab/Session/Class/Decorator/AnonymousTest.php" as="Horde/Kolab/Session/Class/Decorator/AnonymousTest.php" />
diff --git a/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Auth/HordeTest.php b/framework/Kolab_Session/test/Horde/Kolab/Session/Class/Auth/HordeTest.php
deleted file mode 100644 (file)
index 0f6ea9b..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Test the horde auth driver.
- *
- * PHP version 5
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-
-/**
- * Prepare the test setup.
- */
-require_once dirname(__FILE__) . '/../../Autoload.php';
-
-/**
- * Test the horde auth driver.
- *
- * Copyright 2009-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @category Kolab
- * @package  Kolab_Session
- * @author   Gunnar Wrobel <wrobel@pardus.de>
- * @license  http://www.fsf.org/copyleft/lgpl.html LGPL
- * @link     http://pear.horde.org/index.php?package=Kolab_Session
- */
-class Horde_Kolab_Session_Class_Auth_HordeTest extends Horde_Kolab_Session_SessionTestCase
-{
-    public function testMethodGetcurrentuserHasResultStringTheCurrentUser()
-    {
-        $_SESSION['horde_auth']['userId'] = 'test';
-        $auth = new Horde_Kolab_Session_Auth_Horde();
-        $this->assertEquals('test', $auth->getCurrentUser());
-    }
-}
\ No newline at end of file
index aefc9b3..31a4f4c 100644 (file)
@@ -35,6 +35,6 @@ class Horde_Kolab_Session_Class_Auth_MockTest extends Horde_Kolab_Session_Sessio
     public function testMethodGetcurrentuserHasResultStringTheCurrentUser()
     {
         $auth = new Horde_Kolab_Session_Auth_Mock('test');
-        $this->assertEquals('test', $auth->getCurrentUser());
+        $this->assertEquals('test', $auth->getAuth());
     }
 }
\ No newline at end of file
index 910f453..61443e7 100644 (file)
@@ -34,9 +34,9 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi
 {
     public function testMethodIsvalidHasResultBooleanTrueIfTheSessionIsNotConnectedAndTheCurrentUserIsAnonymous()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue(''));
         $session = $this->getMock('Horde_Kolab_Session');
         $session->expects($this->once())
@@ -48,9 +48,9 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi
 
     public function testMethodIsvalidHasResultBooleanFalseIfTheSessionIsNotConnected()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $session = $this->getMock('Horde_Kolab_Session');
         $session->expects($this->once())
@@ -62,9 +62,9 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi
 
     public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserDoesNotMatchTheCurrentUserOfTheSession()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('somebody@example.org'));
         $session = $this->getMock('Horde_Kolab_Session');
         $session->expects($this->once())
@@ -76,9 +76,9 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi
 
     public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndNoNewUserWasSet()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $session = $this->getMock('Horde_Kolab_Session');
         $session->expects($this->once())
@@ -90,9 +90,9 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi
 
     public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesNeitherTheCurrentUserMailAndUid()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $session = $this->getMock('Horde_Kolab_Session');
         $session->expects($this->once())
@@ -104,9 +104,9 @@ class Horde_Kolab_Session_Class_Valid_BaseTest extends Horde_Kolab_Session_Sessi
 
     public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesEitherTheCurrentUserMailAndUid()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $session = $this->getMock('Horde_Kolab_Session');
         $session->expects($this->once())
index b496fb1..a7e49d1 100644 (file)
@@ -42,9 +42,9 @@ extends Horde_Kolab_Session_SessionTestCase
 
     public function testMethodIsvalidHasPostconditionThatAnInvalidSessionGetsLogged()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->exactly(2))
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('auth@example.org'));
         $session = $this->getMock('Horde_Kolab_Session');
         $session->expects($this->exactly(2))
index 8973792..1cb7e97 100644 (file)
@@ -41,9 +41,9 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess
 
     public function testMethodIsvalidHasResultBooleanTrueIfTheSessionIsNotConnectedAndTheCurrentUserIsAnonymous()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue(''));
         $composite = $this->_getMockedComposite();
         $session = new Horde_Kolab_Session_Base(
@@ -55,9 +55,9 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess
 
     public function testMethodIsvalidHasResultBooleanFalseIfTheSessionIsNotConnected()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $composite = $this->_getMockedComposite();
         $session = new Horde_Kolab_Session_Base(
@@ -69,9 +69,9 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess
 
     public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserDoesNotMatchTheCurrentUserOfTheSession()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('somebody@example.org'));
         $this->user->expects($this->exactly(5))
             ->method('getSingle')
@@ -90,9 +90,9 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess
 
     public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndNoNewUserWasSet()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $this->user->expects($this->exactly(5))
             ->method('getSingle')
@@ -111,9 +111,9 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess
 
     public function testMethodIsvalidHasResultBooleanFalseIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesNeitherTheCurrentUserMailAndUid()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $this->user->expects($this->exactly(5))
             ->method('getSingle')
@@ -132,9 +132,9 @@ class Horde_Kolab_Session_Integration_ValidTest extends Horde_Kolab_Session_Sess
 
     public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesEitherTheCurrentUserMailAndUid()
     {
-        $auth = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $auth = $this->getMock('Horde_Interfaces_Registry_Auth');
         $auth->expects($this->once())
-            ->method('getCurrentUser')
+            ->method('getAuth')
             ->will($this->returnValue('mail@example.org'));
         $this->user->expects($this->exactly(5))
             ->method('getSingle')
index 4449802..00ebb2c 100644 (file)
@@ -56,7 +56,7 @@ class Horde_Kolab_Session_SessionTestCase extends PHPUnit_Framework_TestCase
     protected function setupFactoryMocks()
     {
         $this->server          = $this->_getMockedComposite();
-        $this->session_auth    = $this->getMock('Horde_Kolab_Session_Auth_Interface');
+        $this->session_auth    = $this->getMock('Horde_Interfaces_Registry_Auth');
         $this->session_storage = $this->getMock('Horde_Kolab_Session_Storage_Interface');
     }
 }
\ No newline at end of file