From: Gunnar Wrobel Date: Wed, 28 Oct 2009 22:53:33 +0000 (+0100) Subject: Fix testing the configuration based factory. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0a5f5b82ccb7bcafd25456679402b5df0f716417;p=horde.git Fix testing the configuration based factory. --- diff --git a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php index 8ba5eb91c..58ef12411 100644 --- a/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php +++ b/framework/Kolab_Server/test/Horde/Kolab/Server/Class/Server/Factory/ConfigurationTest.php @@ -33,138 +33,133 @@ require_once dirname(__FILE__) . '/../../../Autoload.php'; class Horde_Kolab_Server_Class_Server_Factory_ConfigurationTest extends PHPUnit_Framework_TestCase { - public function setUp() - { - $this->factory = $this->getMock('Horde_Kolab_Server_Factory'); - } - public function testMethodGetserverHasResultLoggedServerIfALoggerWasProvidedInTheConfiguration() { - $this->factory->expects($this->once()) - ->method('getServer') - ->will($this->returnValue($this->getMock('Horde_Kolab_Server'))); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array('logger' => 'set') + array('logger' => 'set', 'basedn' => '') ); $this->assertType('Horde_Kolab_Server_Logged', $factory->getServer()); } public function testMethodGetserverHasResultMappedServerIfAMappedWasProvidedInTheConfiguration() { - $this->factory->expects($this->once()) - ->method('getServer') - ->will($this->returnValue($this->getMock('Horde_Kolab_Server'))); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array('map' => array()) + array('map' => array(), 'basedn' => '') ); $this->assertType('Horde_Kolab_Server_Mapped', $factory->getServer()); } public function testMethodGetserverHasResultCleanerServerIfACleanedWasProvidedInTheConfiguration() { - $this->factory->expects($this->once()) - ->method('getServer') - ->will($this->returnValue($this->getMock('Horde_Kolab_Server'))); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array('cleanup' => true) + array('cleanup' => true, 'basedn' => '') ); $this->assertType('Horde_Kolab_Server_Cleaner', $factory->getServer()); } - public function testMethodConstructHasParametersFactoryAndArrayParameters() + public function testMethodConstructHasParametersArrayParameters() { $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') ); } - public function testMethodGetconnectionfactoryGetsDelegated() + public function testMethodGetconnectionfactoryHasResultServerconnectionfactory() { - $this->factory->expects($this->once()) - ->method('getConnectionFactory'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server_Factory_Conn', + $factory->getConnectionFactory() ); - $factory->getConnectionFactory(); } - public function testMethodGetserverGetsDelegated() + public function testMethodGetserverHasResultServer() { - $this->factory->expects($this->once()) - ->method('getServer'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server', + $factory->getServer() ); - $factory->getServer(); } - public function testMethodGetconfigurationGetsDelegated() + public function testMethodGetconfigurationHasResultArray() { - $this->factory->expects($this->once()) - ->method('getConfiguration'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'array', + $factory->getConfiguration() ); - $factory->getConfiguration(); } - public function testMethodGetconnectionGetsDelegated() + public function testMethodGetconnectionHasResultServerconnection() { - $this->factory->expects($this->once()) - ->method('getConnection'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server_Connection', + $factory->getConnection() ); - $factory->getConnection(); } - public function testMethodGetcompositeGetsDelegated() + public function testMethodGetcompositeHasResultServercomposite() { - $this->factory->expects($this->once()) - ->method('getComposite'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server_Composite', + $factory->getComposite() ); - $factory->getComposite(); } - public function testMethodGetobjectsGetsDelegated() + public function testMethodGetobjectsHasResultServerobjects() { - $this->factory->expects($this->once()) - ->method('getObjects'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server_Objects', + $factory->getObjects() ); - $factory->getObjects(); } - public function testMethodGetstructureGetsDelegated() + public function testMethodGetstructureHasresultServerstructure() { - $this->factory->expects($this->once()) - ->method('getStructure'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server_Structure', + $factory->getStructure() ); - $factory->getStructure(); } - public function testMethodGetsearchGetsDelegated() + public function testMethodGetsearchHasResultServersearch() { - $this->factory->expects($this->once()) - ->method('getSearch'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server_Search', + $factory->getSearch() ); - $factory->getSearch(); } - public function testMethodGetschemaGetsDelegated() + public function testMethodGetschemaHasResultServerschema() { - $this->factory->expects($this->once()) - ->method('getSchema'); $factory = new Horde_Kolab_Server_Factory_Configuration( - $this->factory, array() + array('basedn' => '') + ); + $this->assertType( + 'Horde_Kolab_Server_Schema', + $factory->getSchema() ); - $factory->getSchema(); } } \ No newline at end of file