Changeset 1308
- Timestamp:
- 01/28/08 09:32:36 (9 months ago)
- Files:
-
- trunk/build/stubbles/build.xml (modified) (1 diff)
- trunk/src/main/php/net/stubbles/reflection/annotations/stubAnnotationCache.php (modified) (1 diff)
- trunk/src/test/IntegrationTests.php (added)
- trunk/src/test/php/net/stubbles/integration/AnnotationClass.php (deleted)
- trunk/src/test/php/net/stubbles/integration/AnnotationTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/integration/CacheTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/DatabaseTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/EncoderXJConfTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/EventsTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/InterceptorTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/LoggerTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/integration/MemphisConfigTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/ProcessorTestCase.php (modified) (2 diffs)
- trunk/src/test/php/net/stubbles/integration/RegistryTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/VariantManagerTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/stubPageXJConfFactoryTestCase.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/integration/stubRequestValueErrorXJConfFactoryTestCase.php (modified) (1 diff)
- trunk/src/test/runIntegration.php (deleted)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/stubbles/build.xml
r1306 r1308 241 241 <target name="test-integration"> 242 242 <phingcall target="test-preparation" /> 243 <mySimpletest testfile=""${stubbles.base.dir}/src/test/runIntegration.php"" exit="true" /> 244 <!-- run two times, this time with the data cached --> 245 <mySimpletest testfile=""${stubbles.base.dir}/src/test/runIntegration.php"" exit="true" /> 243 <exec passthru="true" command="phpunit src_test_IntegrationTests"/> 246 244 </target> 247 245 trunk/src/main/php/net/stubbles/reflection/annotations/stubAnnotationCache.php
r1296 r1308 46 46 { 47 47 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')); 48 57 } 49 58 trunk/src/test/php/net/stubbles/integration/AnnotationTestCase.php
r1220 r1308 10 10 'net::stubbles::reflection::annotations::stubAbstractAnnotation' 11 11 ); 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 */ 19 class 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 */ 30 class 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 } 13 49 /** 14 50 * Integration test for annotations. … … 17 53 * @subpackage test_integration 18 54 */ 19 class AnnotationTestCase extends UnitTestCase55 class AnnotationTestCase extends PHPUnit_Framework_TestCase 20 56 { 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 21 70 /** 22 71 * assure that annotations containing instances of stubReflectionClass work correct 23 72 * 24 73 * @link http://stubbles.net/ticket/63 74 * @test 25 75 */ 26 public function t estTicket63()76 public function ticket63() 27 77 { 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()); 33 82 } 34 83 } trunk/src/test/php/net/stubbles/integration/CacheTestCase.php
r1220 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class CacheTestCase extends UnitTestCase16 class CacheTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** 19 * assure that creating the cache instances works correct 19 * helper method 20 * 21 * @return stubFileCacheContainer 20 22 */ 21 p ublic function testCacheInitializer()23 protected function getCacheContainer() 22 24 { 23 25 $cacheInitializer = new stubCacheXJConfInitializer(); 24 26 $cacheInitializer->init(); 25 27 $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()); 28 40 } 29 41 } trunk/src/test/php/net/stubbles/integration/DatabaseTestCase.php
r1220 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class DatabaseTestCase extends UnitTestCase16 class DatabaseTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** 19 * assure that creating the logger instances works correct19 * helper method to initialize the connection pool 20 20 */ 21 p ublic function testDatabaseInitializer()21 protected function initInitializer() 22 22 { 23 23 $dbInitializer = new stubDatabaseInitializer(); 24 24 $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(); 25 34 $this->assertTrue(stubDatabaseConnectionPool::hasConnectionData()); 26 35 $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()); 30 47 } 31 48 } trunk/src/test/php/net/stubbles/integration/EncoderXJConfTestCase.php
r1220 r1308 16 16 * @subpackage test_integration 17 17 */ 18 class EncoderXJConfTestCase extends UnitTestCase18 class EncoderXJConfTestCase extends PHPUnit_Framework_TestCase 19 19 { 20 20 /** 21 * access to xjconf21 * helper method 22 22 * 23 * @ varstubXJConfFacade23 * @return stubXJConfFacade 24 24 */ 25 protected $xjconf; 26 27 /** 28 * constructor 29 */ 30 public function __construct() 25 public function getXJConf() 31 26 { 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; 35 31 } 36 32 37 33 /** 38 34 * assure that a base64 encoder is created correct 35 * 36 * @test 39 37 */ 40 public function testBase64Encoder()38 public function instances() 41 39 { 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); 71 60 } 72 61 } trunk/src/test/php/net/stubbles/integration/EventsTestCase.php
r1219 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class EventsTestCase extends UnitTestCase16 class EventsTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** 19 * assure that annotations containing instances of stubReflectionClass work correct 19 * helper method 20 * 20 21 */ 21 p ublic function testEvents()22 protected function initEvents() 22 23 { 23 24 $initializer = new stubEventsXJConfInitializer(); 24 25 $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()); 26 37 $testDispatcher = stubEventDispatcher::getInstance('test'); 27 $this->assertEqual ($testDispatcher->getEventNames(), array('onLogin', 'onLoginSubmit'));38 $this->assertEquals(array('onLogin', 'onLoginSubmit'), $testDispatcher->getEventNames()); 28 39 $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()); 32 48 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()); 33 58 $onLoginSubmit = $testDispatcher->getListenerForEvent('onLoginSubmit'); 34 $this->assert IsA($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()); 37 62 $this->assertFalse($onLoginSubmit['stubCallbackListener']->autoremove()); 38 63 } trunk/src/test/php/net/stubbles/integration/InterceptorTestCase.php
r1220 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class InterceptorTestCase extends UnitTestCase16 class InterceptorTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** 19 * assure that creating the logger instances works correct 19 * helper method 20 * 21 * @return stubInterceptorXJConfInitializer 20 22 */ 21 p ublic function testInterceptorXJConfInitializer()23 protected function initInitializer() 22 24 { 23 25 $interceptorXJConfInitializer = new stubInterceptorXJConfInitializer(); 24 26 $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(); 25 38 $preInterceptors = $interceptorXJConfInitializer->getPreInterceptors(); 26 $this->assert IsA($preInterceptors[0], 'stubShowLastXMLInterceptor');39 $this->assertType('stubShowLastXMLInterceptor', $preInterceptors[0]); 27 40 $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]); 30 51 } 31 52 } trunk/src/test/php/net/stubbles/integration/LoggerTestCase.php
r1220 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class LoggerTestCase extends UnitTestCase16 class LoggerTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** … … 28 28 29 29 /** 30 * assure that creating the logger instances works correct30 * helper method 31 31 */ 32 p ublic function testLoggerXJConfFactory()32 protected function initFactory() 33 33 { 34 34 $loggerXJConfFactory = new stubLoggerXJConfFactory(); 35 35 $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()); 37 47 $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]); 43 64 } 44 65 } trunk/src/test/php/net/stubbles/integration/MemphisConfigTestCase.php
r1246 r1308 16 16 * @subpackage test_integration 17 17 */ 18 class MemphisConfigTestCase extends UnitTestCase18 class MemphisConfigTestCase extends PHPUnit_Framework_TestCase 19 19 { 20 20 /** 21 * assure that loading the memphis config gives correct results21 * set up test environment 22 22 */ 23 public function testConfig()23 public function setUp() 24 24 { 25 25 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 { 26 35 $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()); 28 37 foreach ($memphisConfig->getDefaultElements('navteasers') as $defaultElement) { 29 $this->assert IsA($defaultElement, 'stubMemphisPageElement');38 $this->assertType('stubMemphisPageElement', $defaultElement); 30 39 } 31 40 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')); 40 49 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() 44 76 ); 45 77 } trunk/src/test/php/net/stubbles/integration/ProcessorTestCase.php
r1220 r1308 8 8 */ 9 9 stubClassLoader::load('net::stubbles::websites::processors::stubProcessorResolverXJConfFactory'); 10 Mock::generate('stubRequest');11 Mock::generate('stubResponse');12 Mock::generate('stubSession');13 10 /** 14 11 * Integration test for processors. … … 17 14 * @subpackage test_integration 18 15 */ 19 class ProcessorTestCase extends UnitTestCase16 class ProcessorTestCase extends PHPUnit_Framework_TestCase 20 17 { 21 18 /** 22 * assure that creating a processor resolver returns correct classes 19 * helper method 20 * 21 * @return stubProcessorResolver 23 22 */ 24 p ublic function testProcessorResolverXJConfFactory()23 protected function getProcessorResolver() 25 24 { 26 25 $processorResolverFactory = new stubProcessorResolverXJConfFactory(); 27 26 $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); 30 39 $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); 34 51 } 35 52 } trunk/src/test/php/net/stubbles/integration/RegistryTestCase.php
r1245 r1308 18 18 * @subpackage test_integration 19 19 */ 20 class RegistryTestCase extends UnitTestCase20 class RegistryTestCase extends PHPUnit_Framework_TestCase 21 21 { 22 22 /** 23 * assure that loading the registry gives correct results23 * helper method 24 24 */ 25 p ublic function testInitializing()25 protected function initRegistry() 26 26 { 27 27 $registryInitializer = new stubRegistryXJConfInitializer(); 28 28 $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)); 34 56 } 35 57 } trunk/src/test/php/net/stubbles/integration/VariantManagerTestCase.php
r1220 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class VariantManagerTestCase extends UnitTestCase16 class VariantManagerTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** 19 19 * assure that creating the variant map works correct 20 * 21 * @test 20 22 */ 21 public function testXJConfVariantFactory()23 public function xjConfVariantFactory() 22 24 { 23 25 $variantFactory = new stubVariantXJConfFactory(); 24 26 $variantsMap = $variantFactory->getVariantsMap(); 25 $this->assert IsA($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()); 27 29 $children = $variantsMap->getRootVariant()->getChildren(); 28 $this->assertEqual (count($children), 3);29 $this->assert IsA($children['request'], 'stubRequestParamVariant');30 $this->assertEqual (count($children['request']->getChildren()), 0);31 $this->assert IsA($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']); 32 34 $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())); 38 57 } 39 58 } trunk/src/test/php/net/stubbles/integration/stubPageXJConfFactoryTestCase.php
r1217 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class stubPageXJConfFactoryTestCase extends UnitTestCase16 class stubPageXJConfFactoryTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /** 19 19 * assure that creating the variant map works correct 20 * 21 * @test 20 22 */ 21 public function testPageXJConfFactory()23 public function pageXJConfFactory() 22 24 { 23 25 $pageFactory = new stubPageXJConfFactory(); 24 26 $page = $pageFactory->getPage('conf/index'); 25 $this->assertEqual ($page->getProperty('skin'), 'default');27 $this->assertEquals('default', $page->getProperty('skin')); 26 28 $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']); 31 43 } 32 44 } trunk/src/test/php/net/stubbles/integration/stubRequestValueErrorXJConfFactoryTestCase.php
r1220 r1308 14 14 * @subpackage test_integration 15 15 */ 16 class stubRequestValueErrorXJConfFactoryTestCase extends UnitTestCase16 class stubRequestValueErrorXJConfFactoryTestCase extends PHPUnit_Framework_TestCase 17 17 { 18 18 /**
