Changeset 473
- Timestamp:
- 04/11/07 19:38:18 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/ipo/interceptors/stubPostInterceptor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/interceptors/stubPreInterceptor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/rdbms/stubDatabaseInitializer.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/Binford.php (modified) (3 diffs)
- trunk/src/main/php/net/stubbles/util/log/stubLogPreInterceptor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/util/stubExceptionHandler.php (modified) (2 diffs)
- trunk/src/main/php/net/stubbles/websites/stubFrontController.php (modified) (8 diffs)
- trunk/src/main/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptor.php (modified) (4 diffs)
- trunk/src/main/php/net/stubbles/websites/xml/stubShowLastXMLInterceptor.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/xml/stubXMLPostInterceptor.php (modified) (5 diffs)
- trunk/src/main/php/net/stubbles/websites/xml/stubXMLPreInterceptor.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/TeststubFrontController.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/stubFrontControllerInjectionMapTestCase.php (deleted)
- trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptorCookieVariantTestCase.php (modified) (8 diffs)
- trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptorProcessTestCase.php (modified) (6 diffs)
- trunk/src/test/php/net/stubbles/websites/xml/stubXMLPostInterceptorTestCase.php (modified) (9 diffs)
- trunk/src/test/php/net/stubbles/websites/xml/stubXMLPreInterceptorTestCase.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/interceptors/stubPostInterceptor.php
r142 r473 20 20 /** 21 21 * does the postprocessing stuff 22 * 23 * @param stubRequest $request access to request data 24 * @param stubSession $session access to session data 25 * @param stubResponse $response access to response data 22 26 */ 23 public function postProcess( );27 public function postProcess(stubRequest $request, stubSession $session, stubResponse $response); 24 28 } 25 29 ?> trunk/src/main/php/net/stubbles/ipo/interceptors/stubPreInterceptor.php
r142 r473 20 20 /** 21 21 * does the preprocessing stuff 22 * 23 * @param stubRequest $request access to request data 24 * @param stubSession $session access to session data 25 * @param stubResponse $response access to response data 22 26 */ 23 public function preProcess( );27 public function preProcess(stubRequest $request, stubSession $session, stubResponse $response); 24 28 } 25 29 ?> trunk/src/main/php/net/stubbles/rdbms/stubDatabaseInitializer.php
r443 r473 35 35 /** 36 36 * does the preprocessing stuff 37 * 38 * @param stubRequest $request access to request data 39 * @param stubSession $session access to session data 40 * @param stubResponse $response access to response data 37 41 */ 38 public function preProcess( )42 public function preProcess(stubRequest $request, stubSession $session, stubResponse $response) 39 43 { 40 44 self::init(stubConfig::getConfigPath() . '/xml/rdbms.xml'); trunk/src/main/php/net/stubbles/util/Binford.php
r152 r473 18 18 * @subpackage util 19 19 * @see http://binford.de/ 20 * @Inject(stubResponse)21 20 */ 22 21 final class Binford extends stubBaseObject implements stubValidator, stubFilter, stubPostInterceptor … … 26 25 */ 27 26 const POWER = 6100; 28 /**29 * access to response data30 *31 * @var stubResponse32 */33 protected $response;34 27 35 28 /** … … 109 102 110 103 /** 111 * set the response104 * does the postprocessing stuff 112 105 * 113 * @param stubResponse $response 106 * @param stubRequest $request access to request data 107 * @param stubSession $session access to session data 108 * @param stubResponse $response access to response data 114 109 */ 115 public function setResponse(stubResponse $response)110 public function postProcess(stubRequest $request, stubSession $session, stubResponse $response) 116 111 { 117 $this->response = $response; 118 } 119 120 /** 121 * does the postprocessing stuff 122 */ 123 public function postProcess() 124 { 125 $this->response->addHeader('X-Binford', self::POWER); 112 $response->addHeader('X-Binford', self::POWER); 126 113 } 127 114 trunk/src/main/php/net/stubbles/util/log/stubLogPreInterceptor.php
r431 r473 17 17 { 18 18 /** 19 * initializes logging with the stubLoggerXJConfFactory 19 * does the preprocessing stuff 20 * 21 * @param stubRequest $request access to request data 22 * @param stubSession $session access to session data 23 * @param stubResponse $response access to response data 20 24 */ 21 public function preProcess( )25 public function preProcess(stubRequest $request, stubSession $session, stubResponse $response) 22 26 { 23 27 stubLoggerXJConfFactory::init(stubConfig::getConfigPath() . '/xml/logging.xml'); trunk/src/main/php/net/stubbles/util/stubExceptionHandler.php
r389 r473 16 16 * @package stubbles 17 17 * @subpackage util 18 * @Inject(stubRequest:stubResponse)19 18 */ 20 19 class stubExceptionHandler extends stubBaseObject implements stubPreInterceptor … … 71 70 self::$response->send(); 72 71 } 73 74 /**75 * sets the request instance76 *77 * @param stubRequest $request78 */79 public function setRequest(stubRequest $request)80 {81 self::$request = $request;82 }83 84 /**85 * sets the response instance86 *87 * @param stubResponse $response88 */89 public function setResponse(stubResponse $response)90 {91 self::$response = $response;92 }93 72 94 73 /** 95 74 * does the preprocessing stuff 75 * 76 * @param stubRequest $request access to request data 77 * @param stubSession $session access to session data 78 * @param stubResponse $response access to response data 96 79 */ 97 public function preProcess( )80 public function preProcess(stubRequest $request, stubSession $session, stubResponse $response) 98 81 { 99 self::register(); 82 self::register($request, $response); 83 self::$request = $request; 84 self::$response = $response; 100 85 } 101 86 } trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r419 r473 49 49 protected $resolver; 50 50 /** 51 * the list of injections52 *53 * @var stubInjectionMap54 */55 protected $injectionMap;56 /**57 51 * contains request data 58 52 * … … 95 89 $processorResolverFactory->init(); 96 90 $this->resolver = $processorResolverFactory->getResolver(); 97 $this->createIn jectionMap();91 $this->createInstances(); 98 92 } 99 93 … … 109 103 110 104 /** 111 * creates the injection map105 * creates the required instances 112 106 */ 113 protected function createIn jectionMap()107 protected function createInstances() 114 108 { 115 $this->injectionMap = new stubInjectionMap();116 109 $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.request.class', 'net.stubbles.ipo.request.stubWebRequest'); 117 110 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); … … 125 118 } 126 119 127 $this->injectionMap->addInjection('stubRequest', $this->request);128 129 120 $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.session.class', 'net.stubbles.ipo.session.stubPHPSession'); 130 121 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); … … 138 129 } 139 130 140 $this->injectionMap->addInjection('stubSession', $this->session);141 131 if (null == $this->dispatcher) { 142 132 $this->dispatcher = stubEventDispatcher::getInstance(); … … 145 135 146 136 $this->response = new stubBaseResponse(); 147 $this->injectionMap->addInjection('stubResponse', $this->response);148 137 } 149 138 … … 154 143 { 155 144 foreach ($this->preInterceptors as $preInterceptor) { 156 stubInjectAnnotation::factory($this->injectionMap, $preInterceptor); 157 $preInterceptor->preProcess(); 145 $preInterceptor->preProcess($this->request, $this->session, $this->response); 158 146 if ($this->request->isCancelled() == true) { 159 147 $this->response->send(); … … 163 151 164 152 $this->response = $this->resolver->resolve($this->request, $this->session, $this->response)->process()->getResponse(); 165 $this->injectionMap->addInjection('stubResponse', $this->response);166 167 153 if ($this->request->isCancelled() == false) { 168 154 foreach ($this->postInterceptors as $postInterceptor) { 169 stubInjectAnnotation::factory($this->injectionMap, $postInterceptor);170 $postInterceptor->postProcess( );155 var_dump(get_class($postInterceptor)); 156 $postInterceptor->postProcess($this->request, $this->session, $this->response); 171 157 if ($this->request->isCancelled() == true) { 172 158 break; trunk/src/main/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptor.php
r447 r473 43 43 * @package stubbles 44 44 * @subpackage websites_variantmanager 45 * @Inject(stubRequest:stubSession:stubResponse)46 45 */ 47 46 class stubVariantsPreInterceptor extends stubBaseObject implements stubPreInterceptor 48 47 { 49 48 /** 50 * access to request instance49 * does the preprocessing stuff 51 50 * 52 * @var stubRequest 51 * @param stubRequest $request access to request data 52 * @param stubSession $session access to session data 53 * @param stubResponse $response access to response data 53 54 */ 54 protected $request; 55 /** 56 * access to session instance 57 * 58 * @var stubSession 59 */ 60 protected $session; 61 /** 62 * access to response instance 63 * 64 * @var stubResponse 65 */ 66 protected $response; 67 68 /** 69 * sets the request instance 70 * 71 * @param stubRequest $request 72 */ 73 public function setRequest(stubRequest $request) 55 public function preProcess(stubRequest $request, stubSession $session, stubResponse $response) 74 56 { 75 $this->request = $request; 76 } 77 78 /** 79 * sets the session instance 80 * 81 * @param stubSession $session 82 */ 83 public function setSession(stubSession $session) 84 { 85 $this->session = $session; 86 } 87 88 /** 89 * sets the response instance 90 * 91 * @param stubResponse $response 92 */ 93 public function setResponse(stubResponse $response) 94 { 95 $this->response = $response; 96 } 97 98 /** 99 * does the preprocessing stuff 100 */ 101 public function preProcess() 102 { 103 if ($this->session->hasValue('net.stubbles.websites.variantmanager.variant') == true) { 57 if ($session->hasValue('net.stubbles.websites.variantmanager.variant') == true) { 104 58 return; 105 59 } … … 119 73 $cookieName = stubRegistry::getConfig('net.stubbles.websites.variantmanager.cookie.name', 'variant'); 120 74 if ($variantFactory->getVariantsMap()->shouldUsePersistence() == true) { 121 $variant = $this->getVariantFromCookie($ variantFactory, $cookieName);75 $variant = $this->getVariantFromCookie($session, $response, $variantFactory, $cookieName); 122 76 } 123 77 124 78 if (null == $variant) { 125 $variant = $variantFactory->getVariantsMap()->getVariant($ this->session, $this->request);79 $variant = $variantFactory->getVariantsMap()->getVariant($session, $request); 126 80 } 127 81 128 $ this->session->putValue('net.stubbles.websites.variantmanager.variant', $variant);82 $session->putValue('net.stubbles.websites.variantmanager.variant', $variant); 129 83 $expiring = stubRegistry::getConfig('net.stubbles.websites.variantmanager.cookie.expiring', (86400 * 90)); // 90 days default 130 84 $cookieURL = stubRegistry::getConfig('net.stubbles.websites.variantmanager.cookie.url', null); 131 85 $cookiePath = stubRegistry::getConfig('net.stubbles.websites.variantmanager.cookie.path', '/'); 132 $ this->response->setCookie($this->createCookie($cookieName, $variant->getName(), $expiring, $cookieURL, $cookiePath));86 $response->setCookie($this->createCookie($cookieName, $variant->getName(), $expiring, $cookieURL, $cookiePath)); 133 87 } 134 88 … … 151 105 * @return stubVariant 152 106 */ 153 protected function getVariantFromCookie(stub VariantFactory $variantFactory, $cookieName)107 protected function getVariantFromCookie(stubRequest $request, stubSession $session, stubVariantFactory $variantFactory, $cookieName) 154 108 { 155 if ($ this->request->hasValue($cookieName, stubRequest::SOURCE_COOKIE) == false) {109 if ($request->hasValue($cookieName, stubRequest::SOURCE_COOKIE) == false) { 156 110 return null; 157 111 } 158 112 159 $variantName = $ this->request->getValidatedValue(new stubPreSelectValidator($variantFactory->getVariantNames()), $cookieName, stubRequest::SOURCE_COOKIE);113 $variantName = $request->getValidatedValue(new stubPreSelectValidator($variantFactory->getVariantNames()), $cookieName, stubRequest::SOURCE_COOKIE); 160 114 if (null == $variantName) { 161 115 return null; … … 163 117 164 118 $cookieVariant = $variantFactory->getVariantByName($variantName); 165 $enforcingVariant = $variantFactory->getVariantsMap()->getEnforcingVariant($ this->session, $this->request);119 $enforcingVariant = $variantFactory->getVariantsMap()->getEnforcingVariant($session, $request); 166 120 if (null == $enforcingVariant) { 167 121 return $cookieVariant; trunk/src/main/php/net/stubbles/websites/xml/stubShowLastXMLInterceptor.php
r356 r473 37 37 * @package stubbles 38 38 * @subpackage websites_xml 39 * @Inject(stubRequest:stubSession:stubResponse)40 39 */ 41 40 class stubShowLastXMLInterceptor extends stubBaseObject implements stubPreInterceptor, stubPostInterceptor 42 41 { 43 42 /** 44 * the request instance43 * does the preprocessing stuff 45 44 * 46 * @var stubRequest 45 * @param stubRequest $request access to request data 46 * @param stubSession $session access to session data 47 * @param stubResponse $response access to response data 47 48 */ 48 protected $request; 49 /** 50 * the session instance 51 * 52 * @var stubSession 53 */ 54 protected $session; 55 /** 56 * the response instance 57 * 58 * @var stubResponse 59 */ 60 protected $response; 61 62 /** 63 * the request instance to use 64 * 65 * @param stubRequest $request 66 */ 67 public function setRequest(stubRequest $request) 49 public function preProcess(stubRequest $request, stubSession $session, stubResponse $response) 68 50 { 69 $this->request = $request; 70 } 71 72 /** 73 * the session instance to use 74 * 75 * @param stubSession $request 76 */ 77 public function setSession(stubSession $session) 78 { 79 $this->session = $session; 80 } 81 82 /** 83 * the response instance to use 84 * 85 * @param stubResponse $request 86 */ 87 public function setResponse(stubResponse $response) 88 { 89 $this->response = $response; 90 } 91 92 /** 93 * does the preprocessing stuff 94 */ 95 public function preProcess() 96 { 97 if ($this->request->hasValue('showLastRequestXML') == true && $this->session->isNew() == false) { 98 $this->response->addHeader('Content-type', 'text/xml'); 99 $this->response->write($this->session->getValue('net.stubbles.websites.lastRequestResponseData')); 100 $this->request->cancel(); 51 if ($request->hasValue('showLastRequestXML') == true && $session->isNew() == false) { 52 $response->addHeader('Content-type', 'text/xml'); 53 $response->write($session->getValue('net.stubbles.websites.lastRequestResponseData')); 54 $request->cancel(); 101 55 } 102 56 } 103 57 104 58 /** 105 * Stores the last dom tree 59 * does the postprocessing stuff 60 * 61 * @param stubRequest $request access to request data 62 * @param stubSession $session access to session data 63 * @param stubResponse $response access to response data 106 64 */ 107 public function postProcess() { 108 $this->session->putValue('net.stubbles.websites.lastRequestResponseData', $this->response->getData()); 65 public function postProcess(stubRequest $request, stubSession $session, stubResponse $response) 66 { 67 $session->putValue('net.stubbles.websites.lastRequestResponseData', $response->getData()); 109 68 } 110 69 } trunk/src/main/php/net/stubbles/websites/xml/stubXMLPostInterceptor.php
r440 r473 22 22 * @package stubbles 23 23 * @subpackage websites_xml 24 * @Inject(stubSession:stubResponse)25 24 * @todo make <xsl:import href="copy.xsl"/> work if loaded from a star file 26 25 * in master.xsl and masterXInclude.xsl … … 29 28 class stubXMLPostInterceptor extends stubBaseObject implements stubPostInterceptor 30 29 { 31 /**32 * access to session33 *34 * @var stubSession35 */36 protected $session;37 /**38 * response data39 *40 * @var stubResponse41 */42 protected $response;43 44 30 /** 45 31 * constructor … … 51 37 stubXMLXIncludeStreamWrapper::setCachePath(stubConfig::getCachePath()); 52 38 } 53 54 /**55 * set the session object56 *57 * @param stubSession $session58 */59 public function setSession(stubSession $session)60 {61 $this->session = $session;62 }63 39 64 40 /** 65 * set the response object41 * does the postprocessing stuff 66 42 * 67 * @param stubResponse $response 43 * @param stubRequest $request access to request data 44 * @param stubSession $session access to session data 45 * @param stubResponse $response access to response data 68 46 */ 69 public function setResponse(stubResponse $response) 70 { 71 $this->response = $response; 72 } 73 74 /** 75 * does the postprocessing stuff 76 */ 77 public function postProcess() 47 public function postProcess(stubRequest $request, stubSession $session, stubResponse $response) 78 48 { 79 49 // does not work with another response type 80 if (($ this->response instanceof stubXMLResponse) == false) {50 if (($response instanceof stubXMLResponse) == false) { 81 51 return false; 82 52 } … … 86 56 $xslProcessor->registerCallback('image', $this->createImageCallback()); 87 57 $xslProcessor->importXSLStylesheet($this->createXSLStylesheet()); 88 $page = $ this->response->getPage();58 $page = $response->getPage(); 89 59 $xslProcessor->setParameter('', 'page', $page->getProperty('name')); 90 if ($ this->session->hasValue('net.stubbles.language') == true) {91 $language = $ this->session->getValue('net.stubbles.language');60 if ($session->hasValue('net.stubbles.language') == true) { 61 $language = $session->getValue('net.stubbles.language'); 92 62 } elseif ($page->hasProperty('language') == true) { 93 63 $language = $page->getProperty('language'); … … 109 79 $xslProcessor = $this->createXSLProcessor(); 110 80 $xslProcessor->importXSLStylesheet($resultXSL); 111 $xslProcessor->setXMLDocument(DOMDocument::loadXML($ this->response->getData()));112 $ this->response->replaceData($xslProcessor->transformToDoc()->saveXML());81 $xslProcessor->setXMLDocument(DOMDocument::loadXML($response->getData())); 82 $response->replaceData($xslProcessor->transformToDoc()->saveXML()); 113 83 return true; 114 84 } trunk/src/main/php/net/stubbles/websites/xml/stubXMLPreInterceptor.php
r315 r473 19 19 * @package stubbles 20 20 * @subpackage websites_xml 21 * @Inject(stubRequest:stubSession:stubResponse)22 21 */ 23 22 class stubXMLPreInterceptor extends stubBaseObject implements stubPreInterceptor 24 23 { 25 24 /** 26 * the request instance25 * does the preprocessing stuff 27 26 * 28 * @var stubRequest 27 * @param stubRequest $request access to request data 28 * @param stubSession $session access to session data 29 * @param stubResponse $response access to response data 29 30 */ 30 protected $request; 31 /** 32 * the session instance 33 * 34 * @var stubSession 35 */ 36 protected $session; 37 /** 38 * the response instance 39 * 40 * @var stubResponse 41 */ 42 protected $response; 43 44 /** 45 * the request instance to use 46 * 47 * @param stubRequest $request 48 */ 49 public function setRequest(stubRequest $request) 31 public function preProcess(stubRequest $request, stubSession $session, stubResponse $response) 50 32 { 51 $this->request = $request; 52 } 53 54 /** 55 * the session instance to use 56 * 57 * @param stubSession $request 58 */ 59 public function setSession(stubSession $session) 60 { 61 $this->session = $session; 62 } 63 64 /** 65 * the response instance to use 66 * 67 * @param stubResponse $request 68 */ 69 public function setResponse(stubResponse $response) 70 { 71 $this->response = $response; 72 } 73 74 /** 75 * does the preprocessing stuff 76 */ 77 public function preProcess() 78 { 79 if ($this->request->hasValue('showLastRequestXML') == true && $this->session->isNew() == false) { 80 $this->response->addHeader('Content-type', 'text/xml'); 81 $this->response->write($this->session->getValue('net.stubbles.websites.lastRequestResponseData')); 82 $this->request->cancel(); 33 if ($request->hasValue('showLastRequestXML') == true && $session->isNew() == false) { 34 $response->addHeader('Content-type', 'text/xml'); 35 $response->write($session->getValue('net.stubbles.websites.lastRequestResponseData')); 36 $request->cancel(); 83 37 } 84 38 } trunk/src/test/php/net/stubbles/websites/TeststubFrontController.php
r399 r473 39 39 $this->response = $response; 40 40 } 41 42 public function setInjectionMap(stubInjectionProvider $injectionMap)43 {44 $this->injectionMap = $injectionMap;45 }46 47 /**48 * @return stubInjectionMap49 */50 public function getInjectionMap()51 {52 $this->createInjectionMap();53 return $this->injectionMap;54 }55 41 } 56 42 ?> trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php
r430 r473 22 22 $dir = dirname(__FILE__); 23 23 $this->TestSuite('All websites classes tests'); 24 $this->addTestFile($dir . '/stubFrontControllerInjectionMapTestCase.php');25 24 $this->addTestFile($dir . '/stubFrontControllerProcessTestCase.php'); 26 25 $this->addTestFile($dir . '/stubPageTestCase.php'); trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php
r399 r473 70 70 */ 71 71 protected $mockProcessor; 72 /**73 * the injection map74 *75 * @var stubInjectionMap76 */77 protected $injectionMap;78 72 79 73 /** … … 100 94 $this->mockResponse2 = new MockstubResponse(); 101 95 $this->mockProcessor->setReturnValue('getResponse', $this->mockResponse2); 102 $this->injectionMap = new stubInjectionMap();103 $this->frontController->setInjectionMap($this->injectionMap);104 96 } 105 97 trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptorCookieVariantTestCase.php
r382 r473 20 20 class TestVariantsPreInterceptor extends stubVariantsPreInterceptor 21 21 { 22 public function getCookieVariant(stub VariantFactory $variantFactory, $cookieName)22 public function getCookieVariant(stubRequest $request, stubSession $session, stubVariantFactory $variantFactory, $cookieName) 23 23 { 24 return $this->getVariantFromCookie($ variantFactory, $cookieName);24 return $this->getVariantFromCookie($request, $session, $variantFactory, $cookieName); 25 25 } 26 26 } … … 46 46 protected $mockRequest; 47 47 /** 48 * the mocked session 49 * 50 * @var SimpleMock 51 */ 52 protected $mockSession; 53 /** 48 54 * a mocked variant factory 49 55 * … … 65 71 $this->variantPreInterceptor = new TestVariantsPreInterceptor(); 66 72 $this->mockRequest = new MockstubRequest(); 67 $this-> variantPreInterceptor->setRequest($this->mockRequest);68 $this->mockVariantFactory = new MockstubVariantFactory();69 $this->mockVariantsMap = new MockstubVariantsMap();73 $this->mockSession = new MockstubSession(); 74 $this->mockVariantFactory = new MockstubVariantFactory(); 75 $this->mockVariantsMap = new MockstubVariantsMap(); 70 76 $this->mockVariantFactory->setReturnValue('getVariantsMap', $this->mockVariantsMap); 71 77 } … … 77 83 { 78 84 $this->mockRequest->setReturnValue('hasValue', false); 79 $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mock VariantFactory, 'variant'));85 $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant')); 80 86 } 81 87 … … 88 94 $this->mockRequest->setReturnValue('getValidatedValue', null); 89 95 $this->mockVariantFactory->setReturnValue('getVariantNames', array()); 90 $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mock VariantFactory, 'variant'));96 $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant')); 91 97 } 92 98 … … 104 110 $this->mockVariantFactory->setReturnValue('getVariantByName', $fooVariant); 105 111 $this->mockVariantsMap->setReturnValue('getEnforcingVariant', null); 106 $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mock VariantFactory, 'variant');112 $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant'); 107 113 $this->assertReference($fooVariant, $resultVariant); 108 114 } … … 123 129 $barVariant->setReturnValue('getName', 'barVariant'); 124 130 $this->mockVariantsMap->setReturnValue('getEnforcingVariant', $barVariant); 125 $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mock VariantFactory, 'variant');131 $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant'); 126 132 $this->assertReference($fooVariant, $resultVariant); 127 133 } … … 142 148 $barVariant->setReturnValue('getName', 'foo'); 143 149 $this->mockVariantsMap->setReturnValue('getEnforcingVariant', $barVariant); 144 $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mock VariantFactory, 'variant');150 $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant'); 145 151 $this->assertReference($barVariant, $resultVariant); 146 152 } trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptorProcessTestCase.php
r382 r473 74 74 $this->mockSession = new MockstubSession(); 75 75 $this->mockResponse = new MockstubResponse(); 76 $this->variantPreInterceptor->setRequest($this->mockRequest);77 $this->variantPreInterceptor->setSession($this->mockSession);78 $this->variantPreInterceptor->setResponse($this->mockResponse);79 76 $this->mockVariantFactory = new MockstubVariantFactory(); 80 77 $this->mockVariantsMap = new MockstubVariantsMap(); … … 91 88 $this->mockSession->expectNever('putValue'); 92 89 $this->mockResponse->expectNever('setCookie'); 93 $this->variantPreInterceptor->preProcess( );90 $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 94 91 } 95 92 … … 106 103 $this->variantPreInterceptor->setReturnValue('createVariantFactory', new TestInvalidVariantFactory()); 107 104 $this->expectException('stubVariantConfigurationException'); 108 $this->variantPreInterceptor->preProcess( );105 $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 109 106 } 110 107 … … 127 124 $this->variantPreInterceptor->expect('createCookie', array('variant', 'variantName', '*', null, '/')); 128 125 $this->variantPreInterceptor->setReturnValue('createCookie', stubCookie::create('variant', 'variantName')); 129 $this->variantPreInterceptor->preProcess( );126 $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 130 127 } 131 128 … … 152 149 stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.url', 'example.org'); 153 150 stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.path', '/path/'); 154 $this->variantPreInterceptor->preProcess( );151 $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 155 152 } 156 153 … … 177 174 stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.url', 'example.org'); 178 175 stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.path', '/path/'); 179 $this->variantPreInterceptor->preProcess( );176 $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 180 177 } 181 178 } trunk/src/test/php/net/stubbles/websites/xml/stubXMLPostInterceptorTestCase.php
r342 r473 8 8 */ 9 9 stubClassLoader::load('net.stubbles.websites.xml.stubXMLPostInterceptor'); 10 Mock::generate('stubResponse'); 10 Mock::generate('stubRequest'); 11 Mock::generate('stubSession'); 11 12 Mock::generate('stubSession'); 12 13 Mock::generate('stubXSLProcessor'); … … 37 38 */ 38 39 protected $xmlResponse; 40 /** 41 * mocked request instance 42 * 43 * @var SimpleMock 44 */ 45 protected $mockRequest; 39 46 /** 40 47 * mocked response instance … … 74 81 { 75 82 $this->xmlPostInterceptor = new stubTestXMLPostInterceptor(); 83 $this->mockRequest = new MockstubRequest(); 76 84 $this->mockResponse = new MockstubResponse(); 77 85 $this->mockResponse->setReturnValue('getData', '<foo>bar</foo>'); 78 86 $this->xmlResponse = new stubXMLResponse($this->mockResponse); 79 $this->xmlPostInterceptor->setResponse($this->xmlResponse);80 87 $this->page = new stubPage(); 81 88 $this->xmlResponse->setPage($this->page); 82 89 $this->mockSession = new MockstubSession(); 83 $this->xmlPostInterceptor->setSession($this->mockSession);84 90 $this->mockXSLProcessor = new MockstubXSLProcessor(); 85 91 $domDocument = new DOMDocument(); … … 99 105 public function testWrongResponse() 100 106 { 101 $this->xmlPostInterceptor->setResponse($this->mockResponse); 102 $this->assertFalse($this->xmlPostInterceptor->postProcess()); 107 $this->assertFalse($this->xmlPostInterceptor->postProcess($this->mockRequest, $this->mockSession, $this->mockResponse)); 103 108 } 104 109 … … 113 118 $this->mockXSLProcessor->expectAt(1, 'setParameter', array('', 'lang', 'en_EN')); 114 119 $this->mockResponse->expect('replaceData', array("<?xml version=\"1.0\"?>\n")); 115 $this->assertTrue($this->xmlPostInterceptor->postProcess( ));120 $this->assertTrue($this->xmlPostInterceptor->postProcess($this->mockRequest, $this->mockSession, $this->xmlResponse)); 116 121 } 117 122 … … 123 128 $this->page->setProperty('skin', 'another'); 124 129 $this->xmlPostInterceptor->expect('createXMLSkinDocument', array('another')); 125 $this->assertTrue($this->xmlPostInterceptor->postProcess( ));130 $this->assertTrue($this->xmlPostInterceptor->postProcess($this->mockRequest, $this->mockSession, $this->xmlResponse)); 126 131 } 127 132 … … 133 138 stubRegistry::setConfig('net.stubbles.language', 'foo'); 134 139 $this->mockXSLProcessor->expectAt(1, 'setParameter', array('', 'lang', 'foo')); 135 $this->assertTrue($this->xmlPostInterceptor->postProcess( ));140 $this->assertTrue($this->xmlPostInterceptor->postProcess($this->mockRequest, $this->mockSession, $this->xmlResponse)); 136 141 } 137 142 … … 144 149 stubRegistry::setConfig('net.stubbles.language', 'foo'); 145 150 $this->moc
