Changeset 473

Show
Ignore:
Timestamp:
04/11/07 19:38:18 (1 year ago)
Author:
mikey
Message:

removed use of inject annotation in pre- and postinterceptors

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/ipo/interceptors/stubPostInterceptor.php

    r142 r473  
    2020    /** 
    2121     * 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 
    2226     */ 
    23     public function postProcess(); 
     27    public function postProcess(stubRequest $request, stubSession $session, stubResponse $response); 
    2428} 
    2529?> 
  • trunk/src/main/php/net/stubbles/ipo/interceptors/stubPreInterceptor.php

    r142 r473  
    2020    /** 
    2121     * 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 
    2226     */ 
    23     public function preProcess(); 
     27    public function preProcess(stubRequest $request, stubSession $session, stubResponse $response); 
    2428} 
    2529?> 
  • trunk/src/main/php/net/stubbles/rdbms/stubDatabaseInitializer.php

    r443 r473  
    3535    /** 
    3636     * 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 
    3741     */ 
    38     public function preProcess(
     42    public function preProcess(stubRequest $request, stubSession $session, stubResponse $response
    3943    { 
    4044        self::init(stubConfig::getConfigPath() . '/xml/rdbms.xml'); 
  • trunk/src/main/php/net/stubbles/util/Binford.php

    r152 r473  
    1818 * @subpackage  util 
    1919 * @see         http://binford.de/ 
    20  * @Inject(stubResponse) 
    2120 */ 
    2221final class Binford extends stubBaseObject implements stubValidator, stubFilter, stubPostInterceptor 
     
    2625     */ 
    2726    const POWER = 6100; 
    28     /** 
    29      * access to response data 
    30      * 
    31      * @var  stubResponse 
    32      */ 
    33     protected $response; 
    3427     
    3528    /** 
     
    109102 
    110103    /** 
    111      * set the response 
     104     * does the postprocessing stuff 
    112105     * 
    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 
    114109     */ 
    115     public function setResponse(stubResponse $response) 
     110    public function postProcess(stubRequest $request, stubSession $session, stubResponse $response) 
    116111    { 
    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); 
    126113    } 
    127114     
  • trunk/src/main/php/net/stubbles/util/log/stubLogPreInterceptor.php

    r431 r473  
    1717{ 
    1818    /** 
    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 
    2024     */ 
    21     public function preProcess(
     25    public function preProcess(stubRequest $request, stubSession $session, stubResponse $response
    2226    { 
    2327        stubLoggerXJConfFactory::init(stubConfig::getConfigPath() . '/xml/logging.xml'); 
  • trunk/src/main/php/net/stubbles/util/stubExceptionHandler.php

    r389 r473  
    1616 * @package     stubbles 
    1717 * @subpackage  util 
    18  * @Inject(stubRequest:stubResponse) 
    1918 */ 
    2019class stubExceptionHandler extends stubBaseObject implements stubPreInterceptor 
     
    7170        self::$response->send(); 
    7271    } 
    73      
    74     /** 
    75      * sets the request instance 
    76      * 
    77      * @param  stubRequest  $request 
    78      */ 
    79     public function setRequest(stubRequest $request) 
    80     { 
    81         self::$request = $request; 
    82     } 
    83      
    84     /** 
    85      * sets the response instance 
    86      * 
    87      * @param  stubResponse  $response 
    88      */ 
    89     public function setResponse(stubResponse $response) 
    90     { 
    91         self::$response = $response; 
    92     } 
    9372 
    9473    /** 
    9574     * 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 
    9679     */ 
    97     public function preProcess(
     80    public function preProcess(stubRequest $request, stubSession $session, stubResponse $response
    9881    { 
    99         self::register(); 
     82        self::register($request, $response); 
     83        self::$request  = $request; 
     84        self::$response = $response; 
    10085    } 
    10186} 
  • trunk/src/main/php/net/stubbles/websites/stubFrontController.php

    r419 r473  
    4949    protected $resolver; 
    5050    /** 
    51      * the list of injections 
    52      * 
    53      * @var  stubInjectionMap 
    54      */ 
    55     protected $injectionMap; 
    56     /** 
    5751     * contains request data 
    5852     * 
     
    9589        $processorResolverFactory->init(); 
    9690        $this->resolver = $processorResolverFactory->getResolver(); 
    97         $this->createInjectionMap(); 
     91        $this->createInstances(); 
    9892    } 
    9993     
     
    109103     
    110104    /** 
    111      * creates the injection map 
     105     * creates the required instances 
    112106     */ 
    113     protected function createInjectionMap() 
     107    protected function createInstances() 
    114108    { 
    115         $this->injectionMap = new stubInjectionMap(); 
    116109        $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.request.class', 'net.stubbles.ipo.request.stubWebRequest'); 
    117110        $className   = stubClassLoader::getNonQualifiedClassName($fqClassName); 
     
    125118        } 
    126119 
    127         $this->injectionMap->addInjection('stubRequest', $this->request); 
    128          
    129120        $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.session.class', 'net.stubbles.ipo.session.stubPHPSession'); 
    130121        $className   = stubClassLoader::getNonQualifiedClassName($fqClassName); 
     
    138129        } 
    139130         
    140         $this->injectionMap->addInjection('stubSession', $this->session); 
    141131        if (null == $this->dispatcher) { 
    142132            $this->dispatcher = stubEventDispatcher::getInstance(); 
     
    145135         
    146136        $this->response = new stubBaseResponse(); 
    147         $this->injectionMap->addInjection('stubResponse', $this->response); 
    148137    } 
    149138 
     
    154143    { 
    155144        foreach ($this->preInterceptors as $preInterceptor) { 
    156             stubInjectAnnotation::factory($this->injectionMap, $preInterceptor); 
    157             $preInterceptor->preProcess(); 
     145            $preInterceptor->preProcess($this->request, $this->session, $this->response); 
    158146            if ($this->request->isCancelled() == true) { 
    159147                $this->response->send(); 
     
    163151         
    164152        $this->response = $this->resolver->resolve($this->request, $this->session, $this->response)->process()->getResponse(); 
    165         $this->injectionMap->addInjection('stubResponse', $this->response); 
    166          
    167153        if ($this->request->isCancelled() == false) { 
    168154            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); 
    171157                if ($this->request->isCancelled() == true) { 
    172158                    break; 
  • trunk/src/main/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptor.php

    r447 r473  
    4343 * @package     stubbles 
    4444 * @subpackage  websites_variantmanager 
    45  * @Inject(stubRequest:stubSession:stubResponse) 
    4645 */ 
    4746class stubVariantsPreInterceptor extends stubBaseObject implements stubPreInterceptor 
    4847{ 
    4948    /** 
    50      * access to request instance 
     49     * does the preprocessing stuff 
    5150     * 
    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 
    5354     */ 
    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) 
    7456    { 
    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) { 
    10458            return; 
    10559        } 
     
    11973        $cookieName = stubRegistry::getConfig('net.stubbles.websites.variantmanager.cookie.name', 'variant'); 
    12074        if ($variantFactory->getVariantsMap()->shouldUsePersistence() == true) { 
    121             $variant = $this->getVariantFromCookie($variantFactory, $cookieName); 
     75            $variant = $this->getVariantFromCookie($session, $response, $variantFactory, $cookieName); 
    12276        } 
    12377         
    12478        if (null == $variant) { 
    125             $variant = $variantFactory->getVariantsMap()->getVariant($this->session, $this->request); 
     79            $variant = $variantFactory->getVariantsMap()->getVariant($session, $request); 
    12680        } 
    12781         
    128         $this->session->putValue('net.stubbles.websites.variantmanager.variant', $variant); 
     82        $session->putValue('net.stubbles.websites.variantmanager.variant', $variant); 
    12983        $expiring   = stubRegistry::getConfig('net.stubbles.websites.variantmanager.cookie.expiring', (86400 * 90)); // 90 days default 
    13084        $cookieURL  = stubRegistry::getConfig('net.stubbles.websites.variantmanager.cookie.url', null); 
    13185        $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)); 
    13387    } 
    13488     
     
    151105     * @return  stubVariant 
    152106     */ 
    153     protected function getVariantFromCookie(stubVariantFactory $variantFactory, $cookieName) 
     107    protected function getVariantFromCookie(stubRequest $request, stubSession $session, stubVariantFactory $variantFactory, $cookieName) 
    154108    { 
    155         if ($this->request->hasValue($cookieName, stubRequest::SOURCE_COOKIE) == false) { 
     109        if ($request->hasValue($cookieName, stubRequest::SOURCE_COOKIE) == false) { 
    156110            return null; 
    157111        } 
    158112         
    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); 
    160114        if (null == $variantName) { 
    161115            return null; 
     
    163117         
    164118        $cookieVariant    = $variantFactory->getVariantByName($variantName); 
    165         $enforcingVariant = $variantFactory->getVariantsMap()->getEnforcingVariant($this->session, $this->request); 
     119        $enforcingVariant = $variantFactory->getVariantsMap()->getEnforcingVariant($session, $request); 
    166120        if (null == $enforcingVariant) { 
    167121            return $cookieVariant; 
  • trunk/src/main/php/net/stubbles/websites/xml/stubShowLastXMLInterceptor.php

    r356 r473  
    3737 * @package     stubbles 
    3838 * @subpackage  websites_xml 
    39  * @Inject(stubRequest:stubSession:stubResponse) 
    4039 */ 
    4140class stubShowLastXMLInterceptor extends stubBaseObject implements stubPreInterceptor, stubPostInterceptor 
    4241{ 
    4342    /** 
    44      * the request instance 
     43     * does the preprocessing stuff 
    4544     * 
    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 
    4748     */ 
    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) 
    6850    { 
    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(); 
    10155        } 
    10256    } 
    10357 
    10458    /** 
    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 
    10664     */ 
    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()); 
    10968    } 
    11069} 
  • trunk/src/main/php/net/stubbles/websites/xml/stubXMLPostInterceptor.php

    r440 r473  
    2222 * @package     stubbles 
    2323 * @subpackage  websites_xml 
    24  * @Inject(stubSession:stubResponse) 
    2524 * @todo        make <xsl:import href="copy.xsl"/> work if loaded from a star file 
    2625 *              in master.xsl and masterXInclude.xsl 
     
    2928class stubXMLPostInterceptor extends stubBaseObject implements stubPostInterceptor 
    3029{ 
    31     /** 
    32      * access to session 
    33      * 
    34      * @var  stubSession 
    35      */ 
    36     protected $session; 
    37     /** 
    38      * response data 
    39      * 
    40      * @var  stubResponse 
    41      */ 
    42     protected $response; 
    43      
    4430    /** 
    4531     * constructor 
     
    5137        stubXMLXIncludeStreamWrapper::setCachePath(stubConfig::getCachePath()); 
    5238    } 
    53      
    54     /** 
    55      * set the session object 
    56      * 
    57      * @param  stubSession  $session 
    58      */ 
    59     public function setSession(stubSession $session) 
    60     { 
    61         $this->session = $session; 
    62     } 
    6339 
    6440    /** 
    65      * set the response object 
     41     * does the postprocessing stuff 
    6642     * 
    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 
    6846     */ 
    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) 
    7848    { 
    7949        // does not work with another response type 
    80         if (($this->response instanceof stubXMLResponse) == false) { 
     50        if (($response instanceof stubXMLResponse) == false) { 
    8151            return false; 
    8252        } 
     
    8656        $xslProcessor->registerCallback('image', $this->createImageCallback()); 
    8757        $xslProcessor->importXSLStylesheet($this->createXSLStylesheet()); 
    88         $page = $this->response->getPage(); 
     58        $page = $response->getPage(); 
    8959        $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'); 
    9262        } elseif ($page->hasProperty('language') == true) { 
    9363            $language = $page->getProperty('language'); 
     
    10979        $xslProcessor = $this->createXSLProcessor(); 
    11080        $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()); 
    11383        return true; 
    11484    } 
  • trunk/src/main/php/net/stubbles/websites/xml/stubXMLPreInterceptor.php

    r315 r473  
    1919 * @package     stubbles 
    2020 * @subpackage  websites_xml 
    21  * @Inject(stubRequest:stubSession:stubResponse) 
    2221 */ 
    2322class stubXMLPreInterceptor extends stubBaseObject implements stubPreInterceptor 
    2423{ 
    2524    /** 
    26      * the request instance 
     25     * does the preprocessing stuff 
    2726     * 
    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 
    2930     */ 
    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) 
    5032    { 
    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(); 
    8337        } 
    8438    } 
  • trunk/src/test/php/net/stubbles/websites/TeststubFrontController.php

    r399 r473  
    3939        $this->response = $response; 
    4040    } 
    41      
    42     public function setInjectionMap(stubInjectionProvider $injectionMap) 
    43     { 
    44         $this->injectionMap = $injectionMap; 
    45     } 
    46      
    47     /** 
    48      * @return  stubInjectionMap 
    49      */ 
    50     public function getInjectionMap() 
    51     { 
    52         $this->createInjectionMap(); 
    53         return $this->injectionMap; 
    54     } 
    5541} 
    5642?> 
  • trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php

    r430 r473  
    2222        $dir = dirname(__FILE__); 
    2323        $this->TestSuite('All websites classes tests'); 
    24         $this->addTestFile($dir . '/stubFrontControllerInjectionMapTestCase.php'); 
    2524        $this->addTestFile($dir . '/stubFrontControllerProcessTestCase.php'); 
    2625        $this->addTestFile($dir . '/stubPageTestCase.php'); 
  • trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php

    r399 r473  
    7070     */ 
    7171    protected $mockProcessor; 
    72     /** 
    73      * the injection map 
    74      * 
    75      * @var  stubInjectionMap 
    76      */ 
    77     protected $injectionMap; 
    7872     
    7973    /** 
     
    10094        $this->mockResponse2   = new MockstubResponse(); 
    10195        $this->mockProcessor->setReturnValue('getResponse', $this->mockResponse2); 
    102         $this->injectionMap = new stubInjectionMap(); 
    103         $this->frontController->setInjectionMap($this->injectionMap); 
    10496    } 
    10597 
  • trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptorCookieVariantTestCase.php

    r382 r473  
    2020class TestVariantsPreInterceptor extends stubVariantsPreInterceptor 
    2121{ 
    22     public function getCookieVariant(stubVariantFactory $variantFactory, $cookieName) 
     22    public function getCookieVariant(stubRequest $request, stubSession $session, stubVariantFactory $variantFactory, $cookieName) 
    2323    { 
    24         return $this->getVariantFromCookie($variantFactory, $cookieName); 
     24        return $this->getVariantFromCookie($request, $session, $variantFactory, $cookieName); 
    2525    } 
    2626} 
     
    4646    protected $mockRequest; 
    4747    /** 
     48     * the mocked session 
     49     * 
     50     * @var  SimpleMock 
     51     */ 
     52    protected $mockSession; 
     53    /** 
    4854     * a mocked variant factory 
    4955     * 
     
    6571        $this->variantPreInterceptor = new TestVariantsPreInterceptor(); 
    6672        $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(); 
    7076        $this->mockVariantFactory->setReturnValue('getVariantsMap', $this->mockVariantsMap); 
    7177    } 
     
    7783    { 
    7884        $this->mockRequest->setReturnValue('hasValue', false); 
    79         $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mockVariantFactory, 'variant')); 
     85        $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant')); 
    8086    } 
    8187     
     
    8894        $this->mockRequest->setReturnValue('getValidatedValue', null); 
    8995        $this->mockVariantFactory->setReturnValue('getVariantNames', array()); 
    90         $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mockVariantFactory, 'variant')); 
     96        $this->assertNull($this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant')); 
    9197    } 
    9298     
     
    104110        $this->mockVariantFactory->setReturnValue('getVariantByName', $fooVariant); 
    105111        $this->mockVariantsMap->setReturnValue('getEnforcingVariant', null); 
    106         $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockVariantFactory, 'variant'); 
     112        $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant'); 
    107113        $this->assertReference($fooVariant, $resultVariant); 
    108114    } 
     
    123129        $barVariant->setReturnValue('getName', 'barVariant'); 
    124130        $this->mockVariantsMap->setReturnValue('getEnforcingVariant', $barVariant); 
    125         $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockVariantFactory, 'variant'); 
     131        $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant'); 
    126132        $this->assertReference($fooVariant, $resultVariant); 
    127133    } 
     
    142148        $barVariant->setReturnValue('getName', 'foo'); 
    143149        $this->mockVariantsMap->setReturnValue('getEnforcingVariant', $barVariant); 
    144         $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockVariantFactory, 'variant'); 
     150        $resultVariant = $this->variantPreInterceptor->getCookieVariant($this->mockRequest, $this->mockSession, $this->mockVariantFactory, 'variant'); 
    145151        $this->assertReference($barVariant, $resultVariant); 
    146152    } 
  • trunk/src/test/php/net/stubbles/websites/variantmanager/stubVariantsPreInterceptorProcessTestCase.php

    r382 r473  
    7474        $this->mockSession           = new MockstubSession(); 
    7575        $this->mockResponse          = new MockstubResponse(); 
    76         $this->variantPreInterceptor->setRequest($this->mockRequest); 
    77         $this->variantPreInterceptor->setSession($this->mockSession); 
    78         $this->variantPreInterceptor->setResponse($this->mockResponse); 
    7976        $this->mockVariantFactory = new MockstubVariantFactory(); 
    8077        $this->mockVariantsMap    = new MockstubVariantsMap(); 
     
    9188        $this->mockSession->expectNever('putValue'); 
    9289        $this->mockResponse->expectNever('setCookie'); 
    93         $this->variantPreInterceptor->preProcess(); 
     90        $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 
    9491    } 
    9592     
     
    106103        $this->variantPreInterceptor->setReturnValue('createVariantFactory', new TestInvalidVariantFactory()); 
    107104        $this->expectException('stubVariantConfigurationException'); 
    108         $this->variantPreInterceptor->preProcess(); 
     105        $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 
    109106    } 
    110107     
     
    127124        $this->variantPreInterceptor->expect('createCookie', array('variant', 'variantName', '*', null, '/')); 
    128125        $this->variantPreInterceptor->setReturnValue('createCookie', stubCookie::create('variant', 'variantName')); 
    129         $this->variantPreInterceptor->preProcess(); 
     126        $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 
    130127    } 
    131128     
     
    152149        stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.url', 'example.org'); 
    153150        stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.path', '/path/'); 
    154         $this->variantPreInterceptor->preProcess(); 
     151        $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 
    155152    } 
    156153     
     
    177174        stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.url', 'example.org'); 
    178175        stubRegistry::setConfig('net.stubbles.websites.variantmanager.cookie.path', '/path/'); 
    179         $this->variantPreInterceptor->preProcess(); 
     176        $this->variantPreInterceptor->preProcess($this->mockRequest, $this->mockSession, $this->mockResponse); 
    180177    } 
    181178} 
  • trunk/src/test/php/net/stubbles/websites/xml/stubXMLPostInterceptorTestCase.php

    r342 r473  
    88 */ 
    99stubClassLoader::load('net.stubbles.websites.xml.stubXMLPostInterceptor'); 
    10 Mock::generate('stubResponse'); 
     10Mock::generate('stubRequest'); 
     11Mock::generate('stubSession'); 
    1112Mock::generate('stubSession'); 
    1213Mock::generate('stubXSLProcessor'); 
     
    3738     */ 
    3839    protected $xmlResponse; 
     40    /** 
     41     * mocked request instance 
     42     * 
     43     * @var  SimpleMock 
     44     */ 
     45    protected $mockRequest; 
    3946    /** 
    4047     * mocked response instance 
     
    7481    { 
    7582        $this->xmlPostInterceptor = new stubTestXMLPostInterceptor(); 
     83        $this->mockRequest        = new MockstubRequest(); 
    7684        $this->mockResponse       = new MockstubResponse(); 
    7785        $this->mockResponse->setReturnValue('getData', '<foo>bar</foo>'); 
    7886        $this->xmlResponse        = new stubXMLResponse($this->mockResponse); 
    79         $this->xmlPostInterceptor->setResponse($this->xmlResponse); 
    8087        $this->page               = new stubPage(); 
    8188        $this->xmlResponse->setPage($this->page); 
    8289        $this->mockSession        = new MockstubSession(); 
    83         $this->xmlPostInterceptor->setSession($this->mockSession); 
    8490        $this->mockXSLProcessor   = new MockstubXSLProcessor(); 
    8591        $domDocument = new DOMDocument(); 
     
    99105    public function testWrongResponse() 
    100106    { 
    101         $this->xmlPostInterceptor->setResponse($this->mockResponse); 
    102         $this->assertFalse($this->xmlPostInterceptor->postProcess()); 
     107        $this->assertFalse($this->xmlPostInterceptor->postProcess($this->mockRequest, $this->mockSession, $this->mockResponse)); 
    103108    } 
    104109     
     
    113118        $this->mockXSLProcessor->expectAt(1, 'setParameter', array('', 'lang', 'en_EN')); 
    114119        $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)); 
    116121    } 
    117122     
     
    123128        $this->page->setProperty('skin', 'another'); 
    124129        $this->xmlPostInterceptor->expect('createXMLSkinDocument', array('another')); 
    125         $this->assertTrue($this->xmlPostInterceptor->postProcess()); 
     130        $this->assertTrue($this->xmlPostInterceptor->postProcess($this->mockRequest, $this->mockSession, $this->xmlResponse)); 
    126131    } 
    127132     
     
    133138        stubRegistry::setConfig('net.stubbles.language', 'foo'); 
    134139        $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)); 
    136141    } 
    137142     
     
    144149        stubRegistry::setConfig('net.stubbles.language', 'foo'); 
    145150        $this->moc