Changeset 1121
- Timestamp:
- 12/06/07 15:58:26 (7 months ago)
- Files:
-
- trunk/src/main/php/net/stubbles/websites/cache/stubCachableProcessor.php (added)
- trunk/src/main/php/net/stubbles/websites/cache/stubWebsiteCacheFactory.php (added)
- trunk/src/main/php/net/stubbles/websites/stubFrontController.php (modified) (5 diffs)
- trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r1098 r1121 14 14 'net.stubbles.util.stubRegistry', 15 15 'net.stubbles.util.stubRegistryInitializer', 16 'net.stubbles.websites.cache.stubWebsiteCacheFactory', 16 17 'net.stubbles.websites.processors.stubProcessorResolverFactory' 17 18 … … 55 56 */ 56 57 protected $response; 58 /** 59 * factory for the website cache 60 * 61 * @var stubWebsiteCacheFactory 62 */ 63 protected $websiteCacheFactory; 57 64 58 65 /** … … 115 122 116 123 /** 124 * sets the website cache factory to be used 125 * 126 * @param stubWebsiteCacheFactory $websiteCacheFactory 127 */ 128 public function setWebsiteCacheFactory(stubWebsiteCacheFactory $websiteCacheFactory) 129 { 130 $this->websiteCacheFactory = $websiteCacheFactory; 131 } 132 133 /** 117 134 * does the whole processing 118 135 */ … … 124 141 foreach ($this->interceptorInitializer->getPreInterceptors() as $preInterceptor) { 125 142 $preInterceptor->preProcess($this->request, $this->session, $this->response); 126 if ($this->request->isCancelled() == true) {143 if ($this->request->isCancelled() === true) { 127 144 $this->response->send(); 128 145 return; … … 130 147 } 131 148 149 if (null !== $this->websiteCacheFactory) { 150 $this->websiteCacheFactory->configure($processor); 151 } 152 132 153 $this->response = $processor->process()->getResponse(); 133 if ($this->request->isCancelled() == false) {154 if ($this->request->isCancelled() === false) { 134 155 foreach ($this->interceptorInitializer->getPostInterceptors() as $postInterceptor) { 135 156 $postInterceptor->postProcess($this->request, $this->session, $this->response); 136 if ($this->request->isCancelled() == true) {157 if ($this->request->isCancelled() === true) { 137 158 break; 138 159 } trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php
r737 r1121 18 18 Mock::generate('stubProcessorResolverFactory'); 19 19 Mock::generate('stubRegistryInitializer'); 20 Mock::generate('stubWebsiteCacheFactory'); 20 21 require_once dirname(__FILE__) . '/TeststubFrontController.php'; 21 22 /** … … 75 76 */ 76 77 protected $mockProcessor; 77 78 /** 79 * mocked website cache factory 80 * 81 * @var stubWebsiteCacheFactory 82 */ 83 protected $mockWebsiteCacheFactory; 84 78 85 /** 79 86 * set up test environment … … 97 104 $this->mockResponse2 = new MockstubResponse(); 98 105 $this->mockProcessor->setReturnValue('getResponse', $this->mockResponse2); 106 $this->mockWebsiteCacheFactory = new MockstubWebsiteCacheFactory(); 99 107 } 100 108 … … 117 125 $this->mockProcessor->setReturnValue('getInterceptorDescriptor', 'interceptors'); 118 126 $this->mockProcessor->expectNever('process'); 127 $this->mockWebsiteCacheFactory->expectNever('configure'); 128 $this->frontController->setWebsiteCacheFactory($this->mockWebsiteCacheFactory); 119 129 $this->frontController->process(); 120 130 } 121 131 122 132 /** 123 133 * assure that processing ends when request is cancelled … … 137 147 $this->frontController->process(); 138 148 } 139 149 140 150 /** 141 151 * assure that processing ends when request is cancelled … … 156 166 $this->frontController->process(); 157 167 } 158 168 159 169 /** 160 170 * assure that processing ends when request is cancelled … … 175 185 $this->mockResponse2->expectOnce('send'); 176 186 $this->mockProcessorResolver->expectOnce('resolve'); 187 $this->mockWebsiteCacheFactory->expectOnce('configure'); 188 $this->frontController->setWebsiteCacheFactory($this->mockWebsiteCacheFactory); 177 189 $this->frontController->process(); 178 190 }
