Changeset 1308

Show
Ignore:
Timestamp:
01/28/08 09:32:36 (9 months ago)
Author:
mikey
Message:

continued refactoring #118: converted integration tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/stubbles/build.xml

    r1306 r1308  
    241241  <target name="test-integration"> 
    242242    <phingcall target="test-preparation" /> 
    243     <mySimpletest testfile="&quot;${stubbles.base.dir}/src/test/runIntegration.php&quot;" exit="true" /> 
    244     <!-- run two times, this time with the data cached --> 
    245     <mySimpletest testfile="&quot;${stubbles.base.dir}/src/test/runIntegration.php&quot;" exit="true" /> 
     243    <exec passthru="true" command="phpunit src_test_IntegrationTests"/> 
    246244  </target> 
    247245 
  • trunk/src/main/php/net/stubbles/reflection/annotations/stubAnnotationCache.php

    r1296 r1308  
    4646    { 
    4747        file_put_contents(stubConfig::getCachePath() . '/annotations.cache', serialize(self::$annotations)); 
     48    } 
     49 
     50    /** 
     51     * refreshes cache data 
     52     */ 
     53    public static function refresh() 
     54    { 
     55        file_put_contents(stubConfig::getCachePath() . '/annotations.cache', serialize(self::$annotations)); 
     56        self::$annotations = unserialize(file_get_contents(stubConfig::getCachePath() . '/annotations.cache')); 
    4857    } 
    4958 
  • trunk/src/test/php/net/stubbles/integration/AnnotationTestCase.php

    r1220 r1308  
    1010                      'net::stubbles::reflection::annotations::stubAbstractAnnotation' 
    1111); 
    12 require_once dirname(__FILE__) . '/AnnotationClass.php'; 
     12/** 
     13 * Test class for the annotation integration test. 
     14 * 
     15 * @package     stubbles 
     16 * @subpackage  test_integration 
     17 * @IntegrationAnnotation(AnnotationClass.class) 
     18 */ 
     19class AnnotationClass 
     20
     21    // intentionally empty 
     22
     23/** 
     24 * Test annotation for the annotation integration test. 
     25 * 
     26 * @package     stubbles 
     27 * @subpackage  test_integration 
     28 * @IntegrationAnnotation(AnnotationClass.class) 
     29 */ 
     30class IntegrationAnnotation extends stubAbstractAnnotation 
     31
     32    protected $value; 
     33 
     34    public function setValue($value) 
     35    { 
     36        $this->value = $value; 
     37    } 
     38     
     39    public function getValue() 
     40    { 
     41        return $this->value; 
     42    } 
     43     
     44    public function getAnnotationTarget() 
     45    { 
     46        return stubAnnotation::TARGET_CLASS; 
     47    } 
     48
    1349/** 
    1450 * Integration test for annotations. 
     
    1753 * @subpackage  test_integration 
    1854 */ 
    19 class AnnotationTestCase extends UnitTestCase 
     55class AnnotationTestCase extends PHPUnit_Framework_TestCase 
    2056{ 
     57    /** 
     58     * helper method to create the instance 
     59     * 
     60     * @return  AnnotationClass 
     61     */ 
     62    protected function getInstance() 
     63    { 
     64        $clazz      = new stubReflectionClass('AnnotationClass'); 
     65        $annotation = $clazz->getAnnotation('IntegrationAnnotation'); 
     66        $value      = $annotation->getValue(); 
     67        return $value->newInstance(); 
     68    } 
     69 
    2170    /** 
    2271     * assure that annotations containing instances of stubReflectionClass work correct 
    2372     * 
    2473     * @link  http://stubbles.net/ticket/63 
     74     * @test 
    2575     */ 
    26     public function testTicket63() 
     76    public function ticket63() 
    2777    { 
    28         $clazz      = new stubReflectionClass('AnnotationClass'); 
    29         $annotation = $clazz->getAnnotation('MyAnnotation'); 
    30         $value      = $annotation->getValue(); 
    31         $instance   = $value->newInstance(); 
    32         $this->assertIsA($instance, 'AnnotationClass'); 
     78        $this->assertType('AnnotationClass', $this->getInstance()); 
     79        // cached 
     80        stubAnnotationCache::refresh(); 
     81        $this->assertType('AnnotationClass', $this->getInstance()); 
    3382    } 
    3483} 
  • trunk/src/test/php/net/stubbles/integration/CacheTestCase.php

    r1220 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class CacheTestCase extends UnitTestCase 
     16class CacheTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /** 
    19      * assure that creating the cache instances works correct 
     19     * helper method 
     20     * 
     21     * @return  stubFileCacheContainer 
    2022     */ 
    21     public function testCacheInitializer() 
     23    protected function getCacheContainer() 
    2224    { 
    2325        $cacheInitializer = new stubCacheXJConfInitializer(); 
    2426        $cacheInitializer->init(); 
    2527        $this->assertTrue(stubCache::has('default')); 
    26         $cacheContainer = stubCache::factory('default'); 
    27         $this->assertIsA($cacheContainer, 'stubFileCacheContainer'); 
     28        return stubCache::factory('default'); 
     29    } 
     30 
     31    /** 
     32     * assure that creating the cache instances works correct 
     33     * @test 
     34     */ 
     35    public function cacheInitializer() 
     36    { 
     37        $this->assertType('stubFileCacheContainer', $this->getCacheContainer()); 
     38        // cached 
     39        $this->assertType('stubFileCacheContainer', $this->getCacheContainer()); 
    2840    } 
    2941} 
  • trunk/src/test/php/net/stubbles/integration/DatabaseTestCase.php

    r1220 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class DatabaseTestCase extends UnitTestCase 
     16class DatabaseTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /** 
    19      * assure that creating the logger instances works correct 
     19     * helper method to initialize the connection pool 
    2020     */ 
    21     public function testDatabaseInitializer() 
     21    protected function initInitializer() 
    2222    { 
    2323        $dbInitializer = new stubDatabaseInitializer(); 
    2424        $dbInitializer->init(); 
     25    } 
     26 
     27    /** 
     28     * assure that creating the logger instances works correct 
     29     * @test 
     30     */ 
     31    public function databaseInitializer() 
     32    { 
     33        $this->initInitializer(); 
    2534        $this->assertTrue(stubDatabaseConnectionPool::hasConnectionData()); 
    2635        $connectionData = stubDatabaseConnectionPool::getConnectionData(); 
    27         $this->assertEqual($connectionData->getDSN(), 'mysql:host=localhost;dbname=example'); 
    28         $this->assertEqual($connectionData->getUserName(), 'root'); 
    29         $this->assertEqual($connectionData->getPassword(), 'foo'); 
     36        $this->assertEquals('mysql:host=localhost;dbname=example', $connectionData->getDSN()); 
     37        $this->assertEquals('root', $connectionData->getUserName()); 
     38        $this->assertEquals('foo', $connectionData->getPassword()); 
     39         
     40        // cached 
     41        $this->initInitializer(); 
     42        $this->assertTrue(stubDatabaseConnectionPool::hasConnectionData()); 
     43        $connectionData = stubDatabaseConnectionPool::getConnectionData(); 
     44        $this->assertEquals('mysql:host=localhost;dbname=example', $connectionData->getDSN()); 
     45        $this->assertEquals('root', $connectionData->getUserName()); 
     46        $this->assertEquals('foo', $connectionData->getPassword()); 
    3047    } 
    3148} 
  • trunk/src/test/php/net/stubbles/integration/EncoderXJConfTestCase.php

    r1220 r1308  
    1616 * @subpackage  test_integration 
    1717 */ 
    18 class EncoderXJConfTestCase extends UnitTestCase 
     18class EncoderXJConfTestCase extends PHPUnit_Framework_TestCase 
    1919{ 
    2020    /** 
    21      * access to xjconf 
     21     * helper method 
    2222     * 
    23      * @var  stubXJConfFacade 
     23     * @return  stubXJConfFacade 
    2424     */ 
    25     protected $xjconf; 
    26  
    27     /** 
    28      * constructor 
    29      */ 
    30     public function __construct() 
     25    public function getXJConf() 
    3126    { 
    32         $this->xjconf = new stubXJConfFacade(new XJConfFacade(array('__default' => stubXJConfLoader::getInstance()))); 
    33         $this->xjconf->addDefinitions(stubFactory::getResourceURIs('xjconf/encoder.xml')); 
    34         $this->xjconf->parse(TEST_SRC_PATH . '/resources/xjconf/encoder.xml'); 
     27        $xjconf = new stubXJConfFacade(new XJConfFacade(array('__default' => stubXJConfLoader::getInstance()))); 
     28        $xjconf->addDefinitions(stubFactory::getResourceURIs('xjconf/encoder.xml')); 
     29        $xjconf->parse(TEST_SRC_PATH . '/resources/xjconf/encoder.xml'); 
     30        return $xjconf; 
    3531    } 
    3632 
    3733    /** 
    3834     * assure that a base64 encoder is created correct 
     35     * 
     36     * @test 
    3937     */ 
    40     public function testBase64Encoder() 
     38    public function instances() 
    4139    { 
    42         $base64Encoder = $this->xjconf->getConfigValue('base64'); 
    43         $this->assertIsA($base64Encoder, 'stubBase64Encoder'); 
    44     } 
    45  
    46     /** 
    47      * assure that a md5 encoder is created correct 
    48      */ 
    49     public function testMd5Encoder() 
    50     { 
    51         $md5Encoder = $this->xjconf->getConfigValue('md5'); 
    52         $this->assertIsA($md5Encoder, 'stubMd5Encoder'); 
    53     } 
    54  
    55     /** 
    56      * assure that an url encoder is created correct 
    57      */ 
    58     public function testUrlEncoder() 
    59     { 
    60         $urlEncoder = $this->xjconf->getConfigValue('url'); 
    61         $this->assertIsA($urlEncoder, 'stubURLEncoder'); 
    62     } 
    63  
    64     /** 
    65      * assure that an utf8 encoder is created correct 
    66      */ 
    67     public function testUTF8Encoder() 
    68     { 
    69         $utf8Encoder = $this->xjconf->getConfigValue('utf8'); 
    70         $this->assertIsA($utf8Encoder, 'stubUTF8Encoder'); 
     40        $xjconf = $this->getXJConf(); 
     41        $base64Encoder = $xjconf->getConfigValue('base64'); 
     42        $this->assertType('stubBase64Encoder', $base64Encoder); 
     43        $md5Encoder = $xjconf->getConfigValue('md5'); 
     44        $this->assertType('stubMd5Encoder', $md5Encoder); 
     45        $urlEncoder = $xjconf->getConfigValue('url'); 
     46        $this->assertType('stubURLEncoder', $urlEncoder); 
     47        $utf8Encoder = $xjconf->getConfigValue('utf8'); 
     48        $this->assertType('stubUTF8Encoder', $utf8Encoder); 
     49         
     50        // cached 
     51        $xjconf = $this->getXJConf(); 
     52        $base64Encoder = $xjconf->getConfigValue('base64'); 
     53        $this->assertType('stubBase64Encoder', $base64Encoder); 
     54        $md5Encoder = $xjconf->getConfigValue('md5'); 
     55        $this->assertType('stubMd5Encoder', $md5Encoder); 
     56        $urlEncoder = $xjconf->getConfigValue('url'); 
     57        $this->assertType('stubURLEncoder', $urlEncoder); 
     58        $utf8Encoder = $xjconf->getConfigValue('utf8'); 
     59        $this->assertType('stubUTF8Encoder', $utf8Encoder); 
    7160    } 
    7261} 
  • trunk/src/test/php/net/stubbles/integration/EventsTestCase.php

    r1219 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class EventsTestCase extends UnitTestCase 
     16class EventsTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /** 
    19      * assure that annotations containing instances of stubReflectionClass work correct 
     19     * helper method 
     20     * 
    2021     */ 
    21     public function testEvents() 
     22    protected function initEvents() 
    2223    { 
    2324        $initializer = new stubEventsXJConfInitializer(); 
    2425        $initializer->init(); 
    25         $this->assertEqual(stubEventDispatcher::getInstanceNames(), array('test', '__global')); 
     26    } 
     27 
     28    /** 
     29     * assure that annotations containing instances of stubReflectionClass work correct 
     30     * 
     31     * @test 
     32     */ 
     33    public function events() 
     34    { 
     35        $this->initEvents(); 
     36        $this->assertEquals(array('test', '__global'), stubEventDispatcher::getInstanceNames()); 
    2637        $testDispatcher = stubEventDispatcher::getInstance('test'); 
    27         $this->assertEqual($testDispatcher->getEventNames(), array('onLogin', 'onLoginSubmit')); 
     38        $this->assertEquals(array('onLogin', 'onLoginSubmit'), $testDispatcher->getEventNames()); 
    2839        $onLogin        = $testDispatcher->getListenerForEvent('onLogin'); 
    29         $this->assertIsA($onLogin['UserLoginLogging'], 'UserLoginLogging'); 
    30         $this->assertIsA($onLogin['stubLazyEventListener'], 'stubLazyEventListener'); 
    31         $this->assertEqual($onLogin['stubLazyEventListener']->getLazyClassName(), 'org::stubbles::examples::events::BlackList'); 
     40        $this->assertType('UserLoginLogging', $onLogin['UserLoginLogging']); 
     41        $this->assertType('stubLazyEventListener', $onLogin['stubLazyEventListener']); 
     42        $this->assertEquals('org::stubbles::examples::events::BlackList', $onLogin['stubLazyEventListener']->getLazyClassName()); 
     43        $onLoginSubmit  = $testDispatcher->getListenerForEvent('onLoginSubmit'); 
     44        $this->assertType('stubCallbackListener', $onLoginSubmit['stubCallbackListener']); 
     45        $this->assertEquals('org::stubbles::examples::events::Auth', $onLoginSubmit['stubCallbackListener']->getCallbackClassName()); 
     46        $this->assertEquals('isValid', $onLoginSubmit['stubCallbackListener']->getCallbackMethodName()); 
     47        $this->assertFalse($onLoginSubmit['stubCallbackListener']->autoremove()); 
    3248         
     49        // cached 
     50        $this->initEvents(); 
     51        $this->assertEquals(array('test', '__global'), stubEventDispatcher::getInstanceNames()); 
     52        $testDispatcher = stubEventDispatcher::getInstance('test'); 
     53        $this->assertEquals(array('onLogin', 'onLoginSubmit'), $testDispatcher->getEventNames()); 
     54        $onLogin        = $testDispatcher->getListenerForEvent('onLogin'); 
     55        $this->assertType('UserLoginLogging', $onLogin['UserLoginLogging']); 
     56        $this->assertType('stubLazyEventListener', $onLogin['stubLazyEventListener']); 
     57        $this->assertEquals('org::stubbles::examples::events::BlackList', $onLogin['stubLazyEventListener']->getLazyClassName()); 
    3358        $onLoginSubmit  = $testDispatcher->getListenerForEvent('onLoginSubmit'); 
    34         $this->assertIsA($onLoginSubmit['stubCallbackListener'], 'stubCallbackListener'); 
    35         $this->assertEqual($onLoginSubmit['stubCallbackListener']->getCallbackClassName(), 'org::stubbles::examples::events::Auth'); 
    36         $this->assertEqual($onLoginSubmit['stubCallbackListener']->getCallbackMethodName(), 'isValid'); 
     59        $this->assertType('stubCallbackListener', $onLoginSubmit['stubCallbackListener']); 
     60        $this->assertEquals('org::stubbles::examples::events::Auth', $onLoginSubmit['stubCallbackListener']->getCallbackClassName()); 
     61        $this->assertEquals('isValid', $onLoginSubmit['stubCallbackListener']->getCallbackMethodName()); 
    3762        $this->assertFalse($onLoginSubmit['stubCallbackListener']->autoremove()); 
    3863    } 
  • trunk/src/test/php/net/stubbles/integration/InterceptorTestCase.php

    r1220 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class InterceptorTestCase extends UnitTestCase 
     16class InterceptorTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /** 
    19      * assure that creating the logger instances works correct 
     19     * helper method 
     20     * 
     21     * @return  stubInterceptorXJConfInitializer 
    2022     */ 
    21     public function testInterceptorXJConfInitializer() 
     23    protected function initInitializer() 
    2224    { 
    2325        $interceptorXJConfInitializer = new stubInterceptorXJConfInitializer(); 
    2426        $interceptorXJConfInitializer->init(); 
     27        return $interceptorXJConfInitializer; 
     28    } 
     29 
     30    /** 
     31     * assure that creating the logger instances works correct 
     32     * 
     33     * @test 
     34     */ 
     35    public function interceptorXJConfInitializer() 
     36    { 
     37        $interceptorXJConfInitializer = $this->initInitializer(); 
    2538        $preInterceptors = $interceptorXJConfInitializer->getPreInterceptors(); 
    26         $this->assertIsA($preInterceptors[0], 'stubShowLastXMLInterceptor'); 
     39        $this->assertType('stubShowLastXMLInterceptor', $preInterceptors[0]); 
    2740        $postInterceptors = $interceptorXJConfInitializer->getPostInterceptors(); 
    28         $this->assertIsA($postInterceptors[0], 'stubShowLastXMLInterceptor'); 
    29         $this->assertIsA($postInterceptors[1], 'stubXMLPostInterceptor'); 
     41        $this->assertType('stubShowLastXMLInterceptor', $postInterceptors[0]); 
     42        $this->assertType('stubXMLPostInterceptor', $postInterceptors[1]); 
     43         
     44        // cached 
     45        $interceptorXJConfInitializer = $this->initInitializer(); 
     46        $preInterceptors = $interceptorXJConfInitializer->getPreInterceptors(); 
     47        $this->assertType('stubShowLastXMLInterceptor', $preInterceptors[0]); 
     48        $postInterceptors = $interceptorXJConfInitializer->getPostInterceptors(); 
     49        $this->assertType('stubShowLastXMLInterceptor', $postInterceptors[0]); 
     50        $this->assertType('stubXMLPostInterceptor', $postInterceptors[1]); 
    3051    } 
    3152} 
  • trunk/src/test/php/net/stubbles/integration/LoggerTestCase.php

    r1220 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class LoggerTestCase extends UnitTestCase 
     16class LoggerTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /** 
     
    2828 
    2929    /** 
    30      * assure that creating the logger instances works correct 
     30     * helper method 
    3131     */ 
    32     public function testLoggerXJConfFactory() 
     32    protected function initFactory() 
    3333    { 
    3434        $loggerXJConfFactory = new stubLoggerXJConfFactory(); 
    3535        $loggerXJConfFactory->init(); 
    36         $this->assertEqual(stubLogger::getInstanceList(), array(stubLogger::DEFAULT_ID)); 
     36    } 
     37 
     38    /** 
     39     * assure that creating the logger instances works correct 
     40     * 
     41     * @test 
     42     */ 
     43    public function loggerXJConfFactory() 
     44    { 
     45        $this->initFactory(); 
     46        $this->assertEquals(array(stubLogger::DEFAULT_ID), stubLogger::getInstanceList()); 
    3747        $logAppenders = stubLogger::getInstance()->getLogAppenders(); 
    38         $this->assertEqual(count($logAppenders), 2); 
    39         $this->assertIsA($logAppenders[0], 'stubFileLogAppender'); 
    40         $this->assertEqual($logAppenders[0]->getLogDir(), stubConfig::getLogPath() . '/{Y}/{M}'); 
    41         $this->assertEqual($logAppenders[0]->getMode(), '0777'); 
    42         $this->assertIsA($logAppenders[1], 'stubMemoryLogAppender'); 
     48        $this->assertEquals(2, count($logAppenders)); 
     49        $this->assertType('stubFileLogAppender', $logAppenders[0]); 
     50        $this->assertEquals(stubConfig::getLogPath() . '/{Y}/{M}', $logAppenders[0]->getLogDir()); 
     51        $this->assertEquals('0777', $logAppenders[0]->getMode()); 
     52        $this->assertType('stubMemoryLogAppender', $logAppenders[1]); 
     53         
     54        $this->tearDown(); 
     55        // cached 
     56        $this->initFactory(); 
     57        $this->assertEquals(array(stubLogger::DEFAULT_ID), stubLogger::getInstanceList()); 
     58        $logAppenders = stubLogger::getInstance()->getLogAppenders(); 
     59        $this->assertEquals(2, count($logAppenders)); 
     60        $this->assertType('stubFileLogAppender', $logAppenders[0]); 
     61        $this->assertEquals(stubConfig::getLogPath() . '/{Y}/{M}', $logAppenders[0]->getLogDir()); 
     62        $this->assertEquals('0777', $logAppenders[0]->getMode()); 
     63        $this->assertType('stubMemoryLogAppender', $logAppenders[1]); 
    4364    } 
    4465} 
  • trunk/src/test/php/net/stubbles/integration/MemphisConfigTestCase.php

    r1246 r1308  
    1616 * @subpackage  test_integration 
    1717 */ 
    18 class MemphisConfigTestCase extends UnitTestCase 
     18class MemphisConfigTestCase extends PHPUnit_Framework_TestCase 
    1919{ 
    2020    /** 
    21      * assure that loading the memphis config gives correct results 
     21     * set up test environment 
    2222     */ 
    23     public function testConfig() 
     23    public function setUp() 
    2424    { 
    2525        stubRegistry::setConfig(stubMemphisTemplate::REGISTRY_KEY_DIR, TEST_SRC_PATH . DIRECTORY_SEPARATOR . 'resources'); 
     26    } 
     27 
     28    /** 
     29     * assure that loading the memphis config gives correct results 
     30     * 
     31     * @test 
     32     */ 
     33    public function config() 
     34    { 
    2635        $memphisConfig = new stubMemphisConfig(); 
    27         $this->assertEqual($memphisConfig->getParts(), array('content', 'navteasers', 'teasers', 'annotations', 'header')); 
     36        $this->assertEquals(array('content', 'navteasers', 'teasers', 'annotations', 'header'), $memphisConfig->getParts()); 
    2837        foreach ($memphisConfig->getDefaultElements('navteasers') as $defaultElement) { 
    29             $this->assertIsA($defaultElement, 'stubMemphisPageElement'); 
     38            $this->assertType('stubMemphisPageElement', $defaultElement); 
    3039        } 
    3140         
    32         $this->assertEqual($memphisConfig->getFrame('default'), 'frame/default.tmpl'); 
    33         $this->assertEqual($memphisConfig->getFrame('default_platin'), 'frame/platin.tmpl'); 
    34         $this->assertEqual($memphisConfig->getFrame('default_index'), 'frame/index.tmpl'); 
    35         $this->assertEqual($memphisConfig->getFrame('weitere'), 'frame/weitere.tmpl'); 
    36         $this->assertEqual($memphisConfig->getFrame('popup'), 'frame/popup.tmpl'); 
    37         $this->assertEqual($memphisConfig->getFrame('popup_top'), 'frame/popup_top.tmpl'); 
    38         $this->assertEqual($memphisConfig->getFrame('blank'), 'frame/blank.tmpl'); 
    39         $this->assertEqual($memphisConfig->getFrame('empty'), 'frame/empty.tmpl'); 
     41        $this->assertEquals('frame/default.tmpl', $memphisConfig->getFrame('default')); 
     42        $this->assertEquals('frame/platin.tmpl', $memphisConfig->getFrame('default_platin')); 
     43        $this->assertEquals('frame/index.tmpl', $memphisConfig->getFrame('default_index')); 
     44        $this->assertEquals('frame/weitere.tmpl', $memphisConfig->getFrame('weitere')); 
     45        $this->assertEquals('frame/popup.tmpl', $memphisConfig->getFrame('popup')); 
     46        $this->assertEquals('frame/popup_top.tmpl', $memphisConfig->getFrame('popup_top')); 
     47        $this->assertEquals('frame/blank.tmpl', $memphisConfig->getFrame('blank')); 
     48        $this->assertEquals('frame/empty.tmpl', $memphisConfig->getFrame('empty')); 
    4049         
    41         $this->assertEqual($memphisConfig->getMetaTags(), array('description' => 'This is a description.', 
    42                                                                 'keywords'    => 'keyword1, keyword2' 
    43                                                           ) 
     50        $this->assertEquals(array('description' => 'This is a description.', 
     51                                  'keywords'    => 'keyword1, keyword2' 
     52                            ), 
     53                            $memphisConfig->getMetaTags() 
     54        ); 
     55         
     56        // cached 
     57        $memphisConfig = new stubMemphisConfig(); 
     58        $this->assertEquals(array('content', 'navteasers', 'teasers', 'annotations', 'header'), $memphisConfig->getParts()); 
     59        foreach ($memphisConfig->getDefaultElements('navteasers') as $defaultElement) { 
     60            $this->assertType('stubMemphisPageElement', $defaultElement); 
     61        } 
     62         
     63        $this->assertEquals('frame/default.tmpl', $memphisConfig->getFrame('default')); 
     64        $this->assertEquals('frame/platin.tmpl', $memphisConfig->getFrame('default_platin')); 
     65        $this->assertEquals('frame/index.tmpl', $memphisConfig->getFrame('default_index')); 
     66        $this->assertEquals('frame/weitere.tmpl', $memphisConfig->getFrame('weitere')); 
     67        $this->assertEquals('frame/popup.tmpl', $memphisConfig->getFrame('popup')); 
     68        $this->assertEquals('frame/popup_top.tmpl', $memphisConfig->getFrame('popup_top')); 
     69        $this->assertEquals('frame/blank.tmpl', $memphisConfig->getFrame('blank')); 
     70        $this->assertEquals('frame/empty.tmpl', $memphisConfig->getFrame('empty')); 
     71         
     72        $this->assertEquals(array('description' => 'This is a description.', 
     73                                  'keywords'    => 'keyword1, keyword2' 
     74                            ), 
     75                            $memphisConfig->getMetaTags() 
    4476        ); 
    4577    } 
  • trunk/src/test/php/net/stubbles/integration/ProcessorTestCase.php

    r1220 r1308  
    88 */ 
    99stubClassLoader::load('net::stubbles::websites::processors::stubProcessorResolverXJConfFactory'); 
    10 Mock::generate('stubRequest'); 
    11 Mock::generate('stubResponse'); 
    12 Mock::generate('stubSession'); 
    1310/** 
    1411 * Integration test for processors. 
     
    1714 * @subpackage  test_integration 
    1815 */ 
    19 class ProcessorTestCase extends UnitTestCase 
     16class ProcessorTestCase extends PHPUnit_Framework_TestCase 
    2017{ 
    2118    /** 
    22      * assure that creating a processor resolver returns correct classes 
     19     * helper method 
     20     * 
     21     * @return  stubProcessorResolver 
    2322     */ 
    24     public function testProcessorResolverXJConfFactory() 
     23    protected function getProcessorResolver() 
    2524    { 
    2625        $processorResolverFactory = new stubProcessorResolverXJConfFactory(); 
    2726        $processorResolverFactory->init(); 
    28         $processorResolver = $processorResolverFactory->getResolver(); 
    29         $this->assertIsA($processorResolver, 'stubProcessorResolver'); 
     27        return $processorResolverFactory->getResolver(); 
     28    } 
     29 
     30    /** 
     31     * assure that creating a processor resolver returns correct classes 
     32     * 
     33     * @test 
     34     */ 
     35    public function processorResolverXJConfFactory() 
     36    { 
     37        $processorResolver = $this->getProcessorResolver(); 
     38        $this->assertType('stubProcessorResolver', $processorResolver); 
    3039        $pageFactory = $processorResolver->getPageFactory(); 
    31         $this->assertIsA($pageFactory, 'stubPageFactory'); 
    32         $processor = $processorResolver->resolve(new MockstubRequest(), new MockstubSession(), new MockstubResponse()); 
    33         $this->assertIsA($processor, 'stubProcessor'); 
     40        $this->assertType('stubPageFactory', $pageFactory); 
     41        $processor = $processorResolver->resolve($this->getMock('stubRequest'), $this->getMock('stubSession'), $this->getMock('stubResponse')); 
     42        $this->assertType('stubProcessor', $processor); 
     43         
     44        // cached 
     45        $processorResolver = $this->getProcessorResolver(); 
     46        $this->assertType('stubProcessorResolver', $processorResolver); 
     47        $pageFactory = $processorResolver->getPageFactory(); 
     48        $this->assertType('stubPageFactory', $pageFactory); 
     49        $processor = $processorResolver->resolve($this->getMock('stubRequest'), $this->getMock('stubSession'), $this->getMock('stubResponse')); 
     50        $this->assertType('stubProcessor', $processor); 
    3451    } 
    3552} 
  • trunk/src/test/php/net/stubbles/integration/RegistryTestCase.php

    r1245 r1308  
    1818 * @subpackage  test_integration 
    1919 */ 
    20 class RegistryTestCase extends UnitTestCase 
     20class RegistryTestCase extends PHPUnit_Framework_TestCase 
    2121{ 
    2222    /** 
    23      * assure that loading the registry gives correct results 
     23     * helper method 
    2424     */ 
    25     public function testInitializing() 
     25    protected function initRegistry() 
    2626    { 
    2727        $registryInitializer = new stubRegistryXJConfInitializer(); 
    2828        $registryInitializer->init(); 
    29         $this->assertEqual(stubRegistry::getConfig('net.stubbles.language'), 'en_EN'); 
    30         $this->assertEqual(stubRegistry::getConfig('net.stubbles.number.decimals'), 4); 
    31         $this->assertEqual(stubRegistry::getConfig(stubLogData::CLASS_REGISTRY_KEY), 'net::stubbles::util::log::stubBaseLogData'); 
    32         $this->assertEqual(stubRegistry::getConfig(stubRequest::CLASS_REGISTRY_KEY), 'net::stubbles::ipo::request::stubWebRequest'); 
    33         $this->assertEqual(stubRegistry::getConfig(stubSession::CLASS_REGISTRY_KEY), 'net::stubbles::ipo::session::stubPHPSession'); 
     29    } 
     30 
     31    /** 
     32     * assure that loading the registry gives correct results 
     33     * 
     34     * @test 
     35     */ 
     36    public function initializing() 
     37    { 
     38        $this->initRegistry(); 
     39        $this->assertEquals('en_EN', stubRegistry::getConfig('net.stubbles.language')); 
     40        $this->assertEquals(4, stubRegistry::getConfig('net.stubbles.number.decimals')); 
     41        $this->assertEquals('net::stubbles::util::log::stubBaseLogData', stubRegistry::getConfig(stubLogData::CLASS_REGISTRY_KEY)); 
     42        $this->assertEquals('net::stubbles::ipo::request::stubWebRequest', stubRegistry::getConfig(stubRequest::CLASS_REGISTRY_KEY)); 
     43        $this->assertEquals('net::stubbles::ipo::session::stubPHPSession', stubRegistry::getConfig(stubSession::CLASS_REGISTRY_KEY)); 
     44         
     45        foreach (stubRegistry::getConfigKeys() as $configKey) { 
     46            stubRegistry::removeConfig($configKey); 
     47        } 
     48         
     49        // cached 
     50        $this->initRegistry(); 
     51        $this->assertEquals('en_EN', stubRegistry::getConfig('net.stubbles.language')); 
     52        $this->assertEquals(4, stubRegistry::getConfig('net.stubbles.number.decimals')); 
     53        $this->assertEquals('net::stubbles::util::log::stubBaseLogData', stubRegistry::getConfig(stubLogData::CLASS_REGISTRY_KEY)); 
     54        $this->assertEquals('net::stubbles::ipo::request::stubWebRequest', stubRegistry::getConfig(stubRequest::CLASS_REGISTRY_KEY)); 
     55        $this->assertEquals('net::stubbles::ipo::session::stubPHPSession', stubRegistry::getConfig(stubSession::CLASS_REGISTRY_KEY)); 
    3456    } 
    3557} 
  • trunk/src/test/php/net/stubbles/integration/VariantManagerTestCase.php

    r1220 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class VariantManagerTestCase extends UnitTestCase 
     16class VariantManagerTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /** 
    1919     * assure that creating the variant map works correct 
     20     * 
     21     * @test 
    2022     */ 
    21     public function testXJConfVariantFactory() 
     23    public function xjConfVariantFactory() 
    2224    { 
    2325        $variantFactory = new stubVariantXJConfFactory(); 
    2426        $variantsMap    = $variantFactory->getVariantsMap(); 
    25         $this->assertIsA($variantsMap, 'stubVariantsMap'); 
    26         $this->assertEqual($variantsMap->getVariantNames(), array('request', 'random1', 'lead', 'random2')); 
     27        $this->assertType('stubVariantsMap', $variantsMap); 
     28        $this->assertEquals(array('request', 'random1', 'lead', 'random2'), $variantsMap->getVariantNames()); 
    2729        $children = $variantsMap->getRootVariant()->getChildren(); 
    28         $this->assertEqual(count($children), 3); 
    29         $this->assertIsA($children['request'], 'stubRequestParamVariant'); 
    30         $this->assertEqual(count($children['request']->getChildren()), 0); 
    31         $this->assertIsA($children['random1'], 'stubRandomVariant'); 
     30        $this->assertEquals(3, count($children)); 
     31        $this->assertType('stubRequestParamVariant', $children['request']); 
     32        $this->assertEquals(0, count($children['request']->getChildren())); 
     33        $this->assertType('stubRandomVariant', $children['random1']); 
    3234        $childs = $children['random1']->getChildren(); 
    33         $this->assertEqual(count($childs), 1); 
    34         $this->assertIsA($childs['lead'], 'stubLeadVariant'); 
    35         $this->assertEqual(count($childs['lead']->getChildren()), 0); 
    36         $this->assertIsA($children['random2'], 'stubRandomVariant'); 
    37         $this->assertEqual(count($children['random2']->getChildren()), 0); 
     35        $this->assertEquals(1, count($childs)); 
     36        $this->assertType('stubLeadVariant', $childs['lead']); 
     37        $this->assertEquals(0, count($childs['lead']->getChildren())); 
     38        $this->assertType('stubRandomVariant', $children['random2']); 
     39        $this->assertEquals(0, count($children['random2']->getChildren())); 
     40         
     41        // cached 
     42        $variantFactory = new stubVariantXJConfFactory(); 
     43        $variantsMap    = $variantFactory->getVariantsMap(); 
     44        $this->assertType('stubVariantsMap', $variantsMap); 
     45        $this->assertEquals(array('request', 'random1', 'lead', 'random2'), $variantsMap->getVariantNames()); 
     46        $children = $variantsMap->getRootVariant()->getChildren(); 
     47        $this->assertEquals(3, count($children)); 
     48        $this->assertType('stubRequestParamVariant', $children['request']); 
     49        $this->assertEquals(0, count($children['request']->getChildren())); 
     50        $this->assertType('stubRandomVariant', $children['random1']); 
     51        $childs = $children['random1']->getChildren(); 
     52        $this->assertEquals(1, count($childs)); 
     53        $this->assertType('stubLeadVariant', $childs['lead']); 
     54        $this->assertEquals(0, count($childs['lead']->getChildren())); 
     55        $this->assertType('stubRandomVariant', $children['random2']); 
     56        $this->assertEquals(0, count($children['random2']->getChildren())); 
    3857    } 
    3958} 
  • trunk/src/test/php/net/stubbles/integration/stubPageXJConfFactoryTestCase.php

    r1217 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class stubPageXJConfFactoryTestCase extends UnitTestCase 
     16class stubPageXJConfFactoryTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /** 
    1919     * assure that creating the variant map works correct 
     20     * 
     21     * @test 
    2022     */ 
    21     public function testPageXJConfFactory() 
     23    public function pageXJConfFactory() 
    2224    { 
    2325        $pageFactory = new stubPageXJConfFactory(); 
    2426        $page        = $pageFactory->getPage('conf/index'); 
    25         $this->assertEqual($page->getProperty('skin'), 'default'); 
     27        $this->assertEquals('default', $page->getProperty('skin')); 
    2628        $elements = $page->getElements(); 
    27         $this->assertIsA($elements['Test'], 'TestXMLPageElement'); 
    28         $this->assertIsA($elements['cached'], 'stubXMLPageElementCachingDecorator'); 
    29         $this->assertEqual($elements['cached']->getRequiredClassNames(), array('org::stubbles::examples::pageelements::CurrentTimeXMLPageElement')); 
    30         $this->assertIsA($elements['uncached'], 'CurrentTimeXMLPageElement'); 
     29        $this->assertType('TestXMLPageElement', $elements['Test']); 
     30        $this->assertType('stubXMLPageElementCachingDecorator', $elements['cached']); 
     31        $this->assertEquals(array('org::stubbles::examples::pageelements::CurrentTimeXMLPageElement'), $elements['cached']->getRequiredClassNames()); 
     32        $this->assertType('CurrentTimeXMLPageElement', $elements['uncached']); 
     33         
     34        // cached 
     35        $pageFactory = new stubPageXJConfFactory(); 
     36        $page        = $pageFactory->getPage('conf/index'); 
     37        $this->assertEquals('default', $page->getProperty('skin')); 
     38        $elements = $page->getElements(); 
     39        $this->assertType('TestXMLPageElement', $elements['Test']); 
     40        $this->assertType('stubXMLPageElementCachingDecorator', $elements['cached']); 
     41        $this->assertEquals(array('org::stubbles::examples::pageelements::CurrentTimeXMLPageElement'), $elements['cached']->getRequiredClassNames()); 
     42        $this->assertType('CurrentTimeXMLPageElement', $elements['uncached']); 
    3143    } 
    3244} 
  • trunk/src/test/php/net/stubbles/integration/stubRequestValueErrorXJConfFactoryTestCase.php

    r1220 r1308  
    1414 * @subpackage  test_integration 
    1515 */ 
    16 class stubRequestValueErrorXJConfFactoryTestCase extends UnitTestCase 
     16class stubRequestValueErrorXJConfFactoryTestCase extends PHPUnit_Framework_TestCase 
    1717{ 
    1818    /**