Changeset 344

Show
Ignore:
Timestamp:
03/07/07 14:23:47 (1 year ago)
Author:
mikey
Message:

added tests for for net.stubbles.websites.stubFrontController

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/ioc/injection/stubInjectionProvider.php

    r313 r344  
    1313 * @subpackage  ioc_injection 
    1414 */ 
    15 interface stubInjectionProvider 
     15interface stubInjectionProvider extends stubObject 
    1616{ 
    1717    /** 
  • trunk/src/main/php/net/stubbles/ipo/request/stubRequest.php

    r318 r344  
    2222 * @see         http://stubbles.net/wiki/Docs/Validators 
    2323 */ 
    24 interface stubRequest 
     24interface stubRequest extends stubObject 
    2525{ 
    2626    /** 
  • trunk/src/main/php/net/stubbles/ipo/response/stubResponse.php

    r179 r344  
    1717 * @subpackage  ipo_response 
    1818 */ 
    19 interface stubResponse 
     19interface stubResponse extends stubObject 
    2020{ 
    2121    /** 
  • trunk/src/main/php/net/stubbles/ipo/session/stubSession.php

    r153 r344  
    1414 * @subpackage  ipo_session 
    1515 */ 
    16 interface stubSession 
     16interface stubSession extends stubObject 
    1717{ 
    1818    /** 
  • trunk/src/main/php/net/stubbles/websites/stubFrontController.php

    r335 r344  
    99stubClassLoader::load('net.stubbles.stubFactory', 
    1010                      'net.stubbles.ioc.injection.injection', 
     11                      'net.stubbles.ipo.interceptors.stubPostInterceptor', 
     12                      'net.stubbles.ipo.interceptors.stubPreInterceptor', 
    1113                      'net.stubbles.ipo.request.stubWebRequest', 
    1214                      'net.stubbles.ipo.session.stubPHPSession', 
    1315                      'net.stubbles.ipo.response.stubBaseResponse', 
     16                      'net.stubbles.websites.processors.stubProcessorResolver', 
    1417                      'net.stubbles.util.stubRegistry', 
    1518                      'net.stubbles.util.xjconf.xjconf' 
     
    2831     * @var  array<stubPreInterceptor> 
    2932     */ 
    30     protected $preInterceptors
     33    protected $preInterceptors  = array()
    3134    /** 
    3235     * list of interceptors to call at teardown 
     
    3437     * @var  array<stubPostInterceptor> 
    3538     */ 
    36     protected $postInterceptors
     39    protected $postInterceptors = array()
    3740    /** 
    3841     * the resolver to use for getting the correct processor 
    3942     * 
    40      * @var  stubProcessResolver 
     43     * @var  stubProcessorResolver 
    4144     */ 
    4245    protected $resolver; 
     
    7376    public function __construct() 
    7477    { 
    75         $xjconf = new stubXJConfFacade(array('http://stubbles.net/ipo/interceptors' => stubXJConfLoader::getInstance(), 
    76                                              'http://stubbles.net/websites'         => stubXJConfLoader::getInstance() 
    77                                        ) 
    78                   ); 
     78        $xjconf = $this->createXJConfFacade(); 
    7979        $xjconf->setDefinitionFile(stubFactory::getResourceURI('xjconf/interceptors.xml')); 
    8080        $xjconf->parse(stubConfig::getConfigPath() . '/xml/interceptors.xml'); 
     
    8686        $this->resolver     = $xjconf->getConfigValue('resolver'); 
    8787         
     88        $this->createInjectionMap(); 
     89    } 
     90     
     91    /** 
     92     * creates the injection map 
     93     */ 
     94    protected function createInjectionMap() 
     95    { 
    8896        $this->injectionMap = new stubInjectionMap(); 
    8997        if (stubRegistry::hasConfig('net.stubbles.ipo.request.class') == true) { 
    9098            $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.request.class'); 
    91             stubClassLoader::load($fqClassName); 
    92             $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 
     99            $className   = stubClassLoader::getNonQualifiedClassName($fqClassName); 
     100            if (class_exists($className, false) == false) { 
     101                stubClassLoader::load($fqClassName); 
     102            } 
     103 
    93104            $this->request = new $className(); 
    94105            if (($this->request instanceof stubRequest) == false) { 
     
    103114            $sessionName = stubRegistry::getConfig('net.stubbles.ipo.session.name'); 
    104115        } else { 
    105             $sessionName = 'stubSID'; 
     116            $sessionName = 'SID'; 
    106117        } 
    107118        if (stubRegistry::hasConfig('net.stubbles.ipo.session.class') == true) { 
    108119            $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.session.class'); 
    109             stubClassLoader::load($fqClassName); 
    110             $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 
    111             $this->session   = new $className($sessionName); 
     120            $className   = stubClassLoader::getNonQualifiedClassName($fqClassName); 
     121            if (class_exists($className, false) == false) { 
     122                stubClassLoader::load($fqClassName); 
     123            } 
     124             
     125            $this->session = new $className($sessionName); 
    112126            if (($this->session instanceof stubSession) == false) { 
    113127                throw new stubException('Configured session class is not an instance of stubSession.'); 
     
    139153        $this->injectionMap->addInjection('stubResponse', $this->response); 
    140154         
    141         foreach ($this->postInterceptors as $postInterceptor) { 
    142             stubInjectAnnotation::factory($this->injectionMap, $postInterceptor); 
    143             $postInterceptor->postProcess(); 
    144             if ($this->request->isCancelled() == true) { 
    145                 break; 
     155        if ($this->request->isCancelled() == false) { 
     156            foreach ($this->postInterceptors as $postInterceptor) { 
     157                stubInjectAnnotation::factory($this->injectionMap, $postInterceptor); 
     158                $postInterceptor->postProcess(); 
     159                if ($this->request->isCancelled() == true) { 
     160                    break; 
     161                } 
    146162            } 
    147163        } 
     
    149165        $this->response->send(); 
    150166    } 
     167     
     168    /** 
     169     * creates the stubXJConfFacade 
     170     * 
     171     * @return  stubXJConfFacade 
     172     */ 
     173    protected function createXJConfFacade() 
     174    { 
     175        $xjconf = new stubXJConfFacade(array('http://stubbles.net/ipo/interceptors' => stubXJConfLoader::getInstance(), 
     176                                             'http://stubbles.net/websites'         => stubXJConfLoader::getInstance() 
     177                                       ) 
     178                  ); 
     179         
     180        return $xjconf; 
     181    } 
    151182} 
    152183?> 
  • trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php

    r343 r344  
    2222        $dir = dirname(__FILE__); 
    2323        $this->TestSuite('All websites classes tests'); 
     24        $this->addTestFile($dir . '/stubFrontControllerInjectionMapTestCase.php'); 
     25        $this->addTestFile($dir . '/stubFrontControllerProcessTestCase.php'); 
    2426        $this->addTestFile($dir . '/stubPageTestCase.php'); 
    2527