Changeset 1464
- Timestamp:
- 03/26/08 23:28:58 (4 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r1459 r1464 79 79 $fqClassName = stubRegistry::getConfig(stubRequest::CLASS_REGISTRY_KEY, 'net::stubbles::ipo::request::stubWebRequest'); 80 80 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 81 if (class_exists($className, false) == false) {81 if (class_exists($className, false) === false) { 82 82 stubClassLoader::load($fqClassName); 83 83 } 84 84 85 85 $this->request = new $className(); 86 if (($this->request instanceof stubRequest) == false) {86 if (($this->request instanceof stubRequest) === false) { 87 87 throw new stubRuntimeException('Configured request class is not an instance of net::stubbles::ipo::request::stubRequest.'); 88 88 } … … 90 90 $fqClassName = stubRegistry::getConfig(stubSession::CLASS_REGISTRY_KEY, 'net::stubbles::ipo::session::stubPHPSession'); 91 91 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 92 if (class_exists($className, false) == false) {92 if (class_exists($className, false) === false) { 93 93 stubClassLoader::load($fqClassName); 94 94 } 95 95 96 96 $this->session = new $className($this->request, stubRegistry::getConfig(stubSession::NAME_REGISTRY_KEY, stubSession::DEFAULT_SESSION_NAME)); 97 if (($this->session instanceof stubSession) == false) {97 if (($this->session instanceof stubSession) === false) { 98 98 throw new stubRuntimeException('Configured session class is not an instance of net::stubbles::ipo::session::stubSession.'); 99 99 } trunk/src/test/php/net/stubbles/websites/stubFrontControllerTestCase.php
r1459 r1464 116 116 $mockWebsiteInitializer = $this->getMock('stubWebsiteInitializer'); 117 117 $mockProcessorResolverFactory = $this->getMock('stubProcessorResolverFactory'); 118 $mockWebsiteInitializer->expects($this-> once())->method('getProcessorResolverFactory')->will($this->returnValue($mockProcessorResolverFactory));118 $mockWebsiteInitializer->expects($this->any())->method('getProcessorResolverFactory')->will($this->returnValue($mockProcessorResolverFactory)); 119 119 $this->mockProcessorResolver = $this->getMock('stubProcessorResolver'); 120 120 $this->mockProcessor = $this->getMock('stubProcessor'); 121 $mockProcessorResolverFactory->expects($this-> once())121 $mockProcessorResolverFactory->expects($this->any()) 122 122 ->method('getResolver') 123 123 ->will($this->returnValue($this->mockProcessorResolver)); 124 $this->mockProcessorResolver->expects($this-> once())124 $this->mockProcessorResolver->expects($this->any()) 125 125 ->method('resolve') 126 126 ->will($this->returnValue($this->mockProcessor)); … … 129 129 stubRegistry::setConfig(stubRequest::CLASS_REGISTRY_KEY, get_class($this->getMock('stubRequest'))); 130 130 stubRegistry::setConfig(stubSession::CLASS_REGISTRY_KEY, get_class($this->getMock('stubSession'))); 131 $mockWebsiteInitializer->expects($this-> once())->method('getRegistryInitializer')->will($this->returnValue($this->getMock('stubRegistryInitializer')));132 $mockWebsiteInitializer->expects($this-> once())->method('hasGeneralInitializer')->will($this->returnValue(true));131 $mockWebsiteInitializer->expects($this->any())->method('getRegistryInitializer')->will($this->returnValue($this->getMock('stubRegistryInitializer'))); 132 $mockWebsiteInitializer->expects($this->any())->method('hasGeneralInitializer')->will($this->returnValue(true)); 133 133 $generalInitializer = $this->getMock('stubInitializer'); 134 $generalInitializer->expects($this-> once())->method('init');135 $mockWebsiteInitializer->expects($this-> once())->method('getGeneralInitializer')->will($this->returnValue($generalInitializer));134 $generalInitializer->expects($this->any())->method('init'); 135 $mockWebsiteInitializer->expects($this->any())->method('getGeneralInitializer')->will($this->returnValue($generalInitializer)); 136 136 $this->frontController = new TeststubFrontController($mockWebsiteInitializer); 137 137 … … 300 300 $this->frontController->process(); 301 301 } 302 303 /** 304 * wrong session class throws an exception 305 * 306 * @test 307 * @expectedException stubRuntimeException 308 */ 309 public function wrongRequestClass() 310 { 311 stubRegistry::setConfig(stubRequest::CLASS_REGISTRY_KEY, 'stdClass'); 312 $mockWebsiteInitializer = $this->getMock('stubWebsiteInitializer'); 313 $mockWebsiteInitializer->expects($this->once())->method('getRegistryInitializer')->will($this->returnValue($this->getMock('stubRegistryInitializer'))); 314 $mockWebsiteInitializer->expects($this->once())->method('hasGeneralInitializer')->will($this->returnValue(false)); 315 $frontController = new stubFrontController($mockWebsiteInitializer); 316 } 317 /** 318 * wrong session class throws an exception 319 * 320 * @test 321 * @expectedException stubRuntimeException 322 */ 323 public function wrongSessionClass() 324 { 325 stubRegistry::setConfig(stubRequest::CLASS_REGISTRY_KEY, get_class($this->getMock('stubRequest'))); 326 stubRegistry::setConfig(stubSession::CLASS_REGISTRY_KEY, 'stdClass'); 327 $mockWebsiteInitializer = $this->getMock('stubWebsiteInitializer'); 328 $mockWebsiteInitializer->expects($this->once())->method('getRegistryInitializer')->will($this->returnValue($this->getMock('stubRegistryInitializer'))); 329 $mockWebsiteInitializer->expects($this->once())->method('hasGeneralInitializer')->will($this->returnValue(false)); 330 $frontController = new stubFrontController($mockWebsiteInitializer); 331 } 302 332 } 303 333 ?>
