Adapt to the interface change in Kolab_Session.
authorGunnar Wrobel <p@rdus.de>
Thu, 5 Nov 2009 21:07:08 +0000 (22:07 +0100)
committerGunnar Wrobel <p@rdus.de>
Thu, 5 Nov 2009 21:07:08 +0000 (22:07 +0100)
framework/Auth/lib/Horde/Auth/Kolab.php
framework/Auth/test/Horde/Auth/Kolab/Class/KolabTest.php
framework/Auth/test/Horde/Auth/Kolab/Integration/AuthTest.php

index a2280f9..a000b09 100644 (file)
@@ -84,8 +84,7 @@ class Horde_Auth_Kolab extends Horde_Auth_Base
                     $userId, $credentials
                 );
             } else {
-                $this->_session = $this->_factory->getSession($userId);
-                $this->_session->connect($credentials);
+                $this->_session = $this->_factory->getSession($userId, $credentials);
             }
         }
         return $this->_session;
index 8e1e20f..7af6759 100644 (file)
@@ -41,6 +41,10 @@ class Horde_Auth_Kolab_Class_KolabTest extends PHPUnit_Framework_TestCase
 
         $this->session = $this->getMock('Horde_Kolab_Session');
         $this->factory = $this->getMock('Horde_Kolab_Session_Factory');
+
+        if (!defined('HORDE_BASE')) {
+            define('HORDE_BASE', '/nowhere');
+        }
     }
 
     public function testMethodSetsessionHasParameterSession()
@@ -65,11 +69,8 @@ class Horde_Auth_Kolab_Class_KolabTest extends PHPUnit_Framework_TestCase
         $auth->setSessionFactory($this->factory);
         $this->factory->expects($this->once())
             ->method('getSession')
-            ->with('user')
+            ->with('user', array('password' => 'test'))
             ->will($this->returnValue($this->session));
-        $this->session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'test'));
         $this->assertType(
             'Horde_Kolab_Session',
             $auth->getSession('user', array('password' => 'test'))
@@ -82,11 +83,8 @@ class Horde_Auth_Kolab_Class_KolabTest extends PHPUnit_Framework_TestCase
         $auth->setSessionFactory($this->factory);
         $this->factory->expects($this->once())
             ->method('getSession')
-            ->with('user')
+            ->with('user', array('password' => 'test'))
             ->will($this->returnValue($this->session));
-        $this->session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'test'));
         $this->assertTrue(
             $auth->authenticate('user', array('password' => 'test'), false)
         );
@@ -98,12 +96,9 @@ class Horde_Auth_Kolab_Class_KolabTest extends PHPUnit_Framework_TestCase
         $auth->setSessionFactory($this->factory);
         $this->factory->expects($this->once())
             ->method('getSession')
-            ->with('user')
+            ->with('user', array('password' => 'test'))
             ->will($this->returnValue($this->session));
         $this->session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'test'));
-        $this->session->expects($this->once())
             ->method('getMail')
             ->will($this->returnValue('mail@example.org'));
         /* Untestable with the way the Auth driver is currently structured */
@@ -116,11 +111,7 @@ class Horde_Auth_Kolab_Class_KolabTest extends PHPUnit_Framework_TestCase
         $auth->setSessionFactory($this->factory);
         $this->factory->expects($this->once())
             ->method('getSession')
-            ->with('user')
-            ->will($this->returnValue($this->session));
-        $this->session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'test'))
+            ->with('user', array('password' => 'test'))
             ->will($this->throwException(new Horde_Kolab_Session_Exception('Error')));
         $auth->authenticate('user', array('password' => 'test'), false);
         $this->assertEquals(Horde_Auth::REASON_FAILED, Horde_Auth::getAuthError());
@@ -132,11 +123,7 @@ class Horde_Auth_Kolab_Class_KolabTest extends PHPUnit_Framework_TestCase
         $auth->setSessionFactory($this->factory);
         $this->factory->expects($this->once())
             ->method('getSession')
-            ->with('user')
-            ->will($this->returnValue($this->session));
-        $this->session->expects($this->once())
-            ->method('connect')
-            ->with(array('password' => 'test'))
+            ->with('user', array('password' => 'test'))
             ->will($this->throwException(new Horde_Kolab_Session_Exception_Badlogin('Error')));
         $auth->authenticate('user', array('password' => 'test'), false);
         $this->assertEquals(Horde_Auth::REASON_BADLOGIN, Horde_Auth::getAuthError());
index c536679..085c534 100644 (file)
@@ -57,6 +57,10 @@ class Horde_Auth_Kolab_Integration_AuthTest extends PHPUnit_Framework_TestCase
             )
         );
         $this->factory = new Horde_Kolab_Session_Factory_Configuration($config);
+
+        if (!defined('HORDE_BASE')) {
+            define('HORDE_BASE', '/nowhere');
+        }
     }
 
     public function testKolabLoginViaUid()