Changeset 1185 for trunk/test
- Timestamp:
- 10/07/08 11:03:16 (2 months ago)
- Files:
-
- trunk (modified) (1 prop)
- trunk/test (modified) (1 prop)
- trunk/test/ci-unit.php (copied) (copied from branches/arnoschn/cache/test/ci-unit.php)
- trunk/test/fixtures/app/application_controller.php (modified) (1 diff)
- trunk/test/fixtures/app/base_action_controller.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/base_action_controller.php)
- trunk/test/fixtures/app/base_active_record.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/base_active_record.php)
- trunk/test/fixtures/app/controllers/action_caching_controller.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/controllers/action_caching_controller.php)
- trunk/test/fixtures/app/controllers/cache_sweeper2_controller.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/controllers/cache_sweeper2_controller.php)
- trunk/test/fixtures/app/controllers/cache_sweeper_controller.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/controllers/cache_sweeper_controller.php)
- trunk/test/fixtures/app/controllers/page_caching_controller.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/controllers/page_caching_controller.php) (2 diffs)
- trunk/test/fixtures/app/controllers/people_controller.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/controllers/people_controller.php)
- trunk/test/fixtures/app/sweepers (copied) (copied from branches/arnoschn/cache/test/fixtures/app/sweepers)
- trunk/test/fixtures/app/sweepers/person_sweeper.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/sweepers/person_sweeper.php)
- trunk/test/fixtures/app/sweepers/person_sweeper2.php (copied) (copied from branches/arnoschn/cache/test/fixtures/app/sweepers/person_sweeper2.php)
- trunk/test/fixtures/app/vendor/plugins (modified) (1 prop)
- trunk/test/fixtures/app/views/people (copied) (copied from branches/arnoschn/cache/test/fixtures/app/views/people)
- trunk/test/fixtures/app/views/people/listing.tpl (copied) (copied from branches/arnoschn/cache/test/fixtures/app/views/people/listing.tpl)
- trunk/test/fixtures/config/caching.yml (copied) (copied from branches/arnoschn/cache/test/fixtures/config/caching.yml)
- trunk/test/fixtures/config/config.php (modified) (3 diffs)
- trunk/test/fixtures/config/inflector.yml (copied) (copied from branches/arnoschn/cache/test/fixtures/config/inflector.yml)
- trunk/test/fixtures/config/sessions.yml (copied) (copied from branches/arnoschn/cache/test/fixtures/config/sessions.yml)
- trunk/test/fixtures/config/testconfig1.yml (copied) (copied from branches/arnoschn/cache/test/fixtures/config/testconfig1.yml)
- trunk/test/fixtures/data/invalid_xhtml.html (copied) (copied from branches/arnoschn/cache/test/fixtures/data/invalid_xhtml.html)
- trunk/test/fixtures/data/plugin_installer_method_extensions.php (copied) (copied from branches/arnoschn/cache/test/fixtures/data/plugin_installer_method_extensions.php)
- trunk/test/fixtures/data/plugin_installer_target_class.php (copied) (copied from branches/arnoschn/cache/test/fixtures/data/plugin_installer_target_class.php)
- trunk/test/fixtures/data/plugin_installer_target_class.php.tpl (copied) (copied from branches/arnoschn/cache/test/fixtures/data/plugin_installer_target_class.php.tpl)
- trunk/test/fixtures/data/reflection_doc_block_test_class.php (copied) (copied from branches/arnoschn/cache/test/fixtures/data/reflection_doc_block_test_class.php)
- trunk/test/fixtures/data/reflection_test_class.php (copied) (copied from branches/arnoschn/cache/test/fixtures/data/reflection_test_class.php)
- trunk/test/fixtures/data/reflection_test_classes.php (copied) (copied from branches/arnoschn/cache/test/fixtures/data/reflection_test_classes.php)
- trunk/test/fixtures/data/valid_xhtml.html (copied) (copied from branches/arnoschn/cache/test/fixtures/data/valid_xhtml.html)
- trunk/test/fixtures/public/images (modified) (1 prop)
- trunk/test/fixtures/public/index.php (modified) (1 diff)
- trunk/test/mocks/test_script_AkSession.php (copied) (copied from branches/arnoschn/cache/test/mocks/test_script_AkSession.php)
- trunk/test/single.php (copied) (copied from branches/arnoschn/cache/test/single.php)
- trunk/test/unit/config (copied) (copied from branches/arnoschn/cache/test/unit/config)
- trunk/test/unit/lib/Ak.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/Ak.php)
- trunk/test/unit/lib/AkActionController.php (modified) (1 diff)
- trunk/test/unit/lib/AkActionController/_action_caching.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkActionController/_action_caching.php)
- trunk/test/unit/lib/AkActionController/_page_caching.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkActionController/_page_caching.php) (2 diffs)
- trunk/test/unit/lib/AkActionController/_respond_to_format.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkActionController/_respond_to_format.php) (1 diff)
- trunk/test/unit/lib/AkActionController/_sweeper.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkActionController/_sweeper.php) (2 diffs)
- trunk/test/unit/lib/AkActionView/helpers/cache_helper.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkActionView/helpers/cache_helper.php) (2 diffs)
- trunk/test/unit/lib/AkActiveRecord/_AkActiveRecord_1.php (modified) (1 diff)
- trunk/test/unit/lib/AkActiveRecord/_AkActiveRecord_connection_handling.php (modified) (1 diff)
- trunk/test/unit/lib/AkActiveRecord/_to_formats.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkActiveRecord/_to_formats.php)
- trunk/test/unit/lib/AkCache (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkCache)
- trunk/test/unit/lib/AkCache.php (modified) (5 diffs)
- trunk/test/unit/lib/AkCache/AkMemcache.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkCache/AkMemcache.php)
- trunk/test/unit/lib/AkConfig.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkConfig.php)
- trunk/test/unit/lib/AkInflector.php (modified) (2 diffs)
- trunk/test/unit/lib/AkPluginInstaller.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkPluginInstaller.php)
- trunk/test/unit/lib/AkReflection (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkReflection)
- trunk/test/unit/lib/AkReflection.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkReflection.php)
- trunk/test/unit/lib/AkReflection/AkReflectionClass.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkReflection/AkReflectionClass.php)
- trunk/test/unit/lib/AkReflection/AkReflectionDocBlock.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkReflection/AkReflectionDocBlock.php)
- trunk/test/unit/lib/AkReflection/AkReflectionFile.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkReflection/AkReflectionFile.php)
- trunk/test/unit/lib/AkReflection/AkReflectionFunction.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkReflection/AkReflectionFunction.php)
- trunk/test/unit/lib/AkSession.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkSession.php)
- trunk/test/unit/lib/AkTestApplication.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkTestApplication.php) (1 diff)
- trunk/test/unit/lib/AkType (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkType)
- trunk/test/unit/lib/AkType/AkNumber.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkType/AkNumber.php)
- trunk/test/unit/lib/AkType/AkString.php (copied) (copied from branches/arnoschn/cache/test/unit/lib/AkType/AkString.php)
- trunk/test/unit/suites (copied) (copied from branches/arnoschn/cache/test/unit/suites)
- trunk/test/unit/suites/actioncontroller.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/actioncontroller.php)
- trunk/test/unit/suites/actionmailer.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/actionmailer.php)
- trunk/test/unit/suites/actionview.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/actionview.php)
- trunk/test/unit/suites/activerecord.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/activerecord.php)
- trunk/test/unit/suites/cache.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/cache.php)
- trunk/test/unit/suites/core.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/core.php)
- trunk/test/unit/suites/localize.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/localize.php)
- trunk/test/unit/suites/phphacks.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/phphacks.php)
- trunk/test/unit/suites/plugin.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/plugin.php)
- trunk/test/unit/suites/reflection.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/reflection.php)
- trunk/test/unit/suites/request.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/request.php)
- trunk/test/unit/suites/type.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/type.php)
- trunk/test/unit/suites/utils.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/utils.php)
- trunk/test/unit/suites/webservice.php (copied) (copied from branches/arnoschn/cache/test/unit/suites/webservice.php)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk
- Property svn:ignore changed from
tmp/*
to
.project
- Property svn:ignore changed from
trunk/test
- Property svn:ignore set to
report
- Property svn:ignore set to
trunk/test/fixtures/app/application_controller.php
r412 r1185 1 1 <?php 2 2 3 require_once(AK_ LIB_DIR.DS.'AkActionController.php');3 require_once(AK_APP_DIR.DS.'base_action_controller.php'); 4 4 5 class ApplicationController extends AkActionController5 class ApplicationController extends BaseActionController 6 6 { 7 7 var $layout = false; 8 8 9 } 9 10 trunk/test/fixtures/app/controllers/page_caching_controller.php
r1164 r1185 4 4 { 5 5 6 var $caches_page = array(' index','ok','no_content','found','not_found','simple', 'priority',6 var $caches_page = array('format','index','ok','no_content','found','not_found','simple', 'priority', 7 7 'skip'); 8 8 … … 15 15 16 16 } 17 18 function format() 19 { 20 if (!$this->respondToFormat()) { 21 $this->renderText('<h1>hello business</h1>'); 22 } 23 } 24 25 function _handleFormatAsXml() 26 { 27 $this->renderText('<hello>business</hello>'); 28 } 29 30 function _handleFormatAsCsv() 31 { 32 $this->renderText('hello,business'); 33 } 34 17 35 function index() 18 36 { trunk/test/fixtures/app/vendor/plugins
- Property svn:externals set to
- Property svn:externals set to
trunk/test/fixtures/config/config.php
r553 r1185 2 2 3 3 error_reporting(E_ALL); 4 5 defined('AK_CACHE_HANDLER') ? null: define('AK_CACHE_HANDLER', 1); 4 6 5 7 defined('AK_ENVIRONMENT') ? null : define('AK_ENVIRONMENT', 'testing'); … … 31 33 defined('AK_ACTIVE_RECORD_ENABLE_AUTOMATIC_SETTERS_AND_GETTERS') ? null : define('AK_ACTIVE_RECORD_ENABLE_AUTOMATIC_SETTERS_AND_GETTERS', true); 32 34 33 defined('AK_TESTING_URL') ? null : define('AK_TESTING_URL', rtrim(AK_URL,'/').'/test/fixtures/public'); 35 //defined('AK_TESTING_URL') ? null : define('AK_TESTING_URL', rtrim(AK_URL,'/').'/test/fixtures/public'); 36 37 defined('AK_TESTING_URL') ? null : define('AK_TESTING_URL', 'http://localhost:81/test/fixtures/public'); 34 38 defined('AK_TESTING_REWRITE_BASE') ? null : define('AK_TESTING_REWRITE_BASE', false); 35 39 … … 41 45 42 46 if(defined('AK_TEST_DATABASE_ON')){ 43 $default_profile = !empty($argv) && array_key_exists($argv[count($argv)-1], $database_settings) ? array_pop($argv) :AK_ENVIRONMENT;47 $default_profile = AK_ENVIRONMENT; 44 48 define('AK_DEFAULT_DATABASE_PROFILE', $default_profile); 45 $GLOBALS['database_settings'] = $database_settings;49 //$GLOBALS['database_settings'] = $database_settings; 46 50 include_once(AK_LIB_DIR.DS.'Ak.php'); 47 51 Ak::db(); trunk/test/fixtures/public/images
- Property svn:ignore set to
akelos_framework_logo.png_300x300.png
akelos_framework_logo.png_340x150.png
akelos_framework_logo.png_50x22.jpg
akelos_framework_logo.png_680x300.png
akelos_framework_logo.png_85x37.png
akelos_framework_logo.png_x300.png
akelos_framework_logo.png.gif
akelos_framework_logo.png.jpg
- Property svn:ignore set to
trunk/test/fixtures/public/index.php
r357 r1185 1 1 <?php 2 2 //define('AK_HOST','localhost'); 3 3 include_once(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php'); 4 5 require_once(AK_LIB_DIR.DS.'AkDispatcher.php'); 4 $host = AK_HOST; 5 require_once(AK_LIB_DIR.DS.'Ak.php'); 6 $cache_settings = Ak::getSettings('caching', false); 7 if ($cache_settings['enabled']) { 8 9 require_once(AK_LIB_DIR . DS . 'AkActionController'.DS.'AkCacheHandler.php'); 10 $null = null; 11 $pageCache = &Ak::singleton('AkCacheHandler',$null); 12 13 $pageCache->init($null, $cache_settings); 14 if (isset($_GET['allow_get'])) { 15 $options['include_get_parameters'] = split(',',$_GET['allow_get']); 16 } 17 18 if (isset($_GET['use_if_modified_since'])) { 19 $options['use_if_modified_since'] = true; 20 } 21 if (($cachedPage = $pageCache->getCachedPage())!==false) { 22 $cachedPage->render(); 23 } 24 } 25 require_once(AK_LIB_DIR . DS . 'AkDispatcher.php'); 6 26 $Dispatcher =& new AkDispatcher(); 7 27 $Dispatcher->dispatch(); trunk/test/unit/lib/AkActionController.php
r1145 r1185 21 21 'http_authentication', 22 22 'model_instantiation', 23 'page_caching', 24 'action_caching', 25 'sweeper', 26 'respond_to_format' 23 27 ); 24 28 trunk/test/unit/lib/AkActionController/_page_caching.php
r1163 r1185 230 230 $cachedPage = $this->_getCachedPage($path); 231 231 $this->assertTrue($cachedPage!=false,$message==false?"$path should be cached":$message); 232 $this->assertIsA($cachedPage,'AkCachedPage'); 233 return $cachedPage!=false && is_a($cachedPage,'AkCachedPage'); 232 return $cachedPage!=false && file_exists($cachedPage); 234 233 } 235 234 function _assertPageNotCached($path, $message = '%s') … … 389 388 390 389 } 390 391 function test_format_caching() 392 { 393 $this->_flushCache('www.example.com'); 394 $this->get('http://www.example.com/page_caching/format'); 395 $this->assertHeader('Content-Type','text/html'); 396 $this->assertTextMatch('<h1>hello business</h1>'); 397 398 $this->_assertPageCached('/page_caching/format'); 399 $this->_assertPageCached('/page_caching/format.html'); 400 $this->_assertPageNotCached('/page_caching/format.xml'); 401 $this->_assertPageNotCached('/page_caching/format.csv'); 402 403 $this->get('http://www.example.com/page_caching/format'); 404 $this->assertHeader('Content-Type','text/html'); 405 $this->assertHeader('X-Cached-By','Akelos'); 406 $this->assertTextMatch('<h1>hello business</h1>'); 407 408 $this->get('http://www.example.com/page_caching/format.xml'); 409 $this->assertHeader('Content-Type','application/xml'); 410 $this->assertTextMatch('<hello>business</hello>'); 411 412 $this->_assertPageCached('/page_caching/format'); 413 $this->_assertPageCached('/page_caching/format.html'); 414 $this->_assertPageCached('/page_caching/format.xml'); 415 $this->_assertPageNotCached('/page_caching/format.csv'); 416 417 $this->get('http://www.example.com/page_caching/format.xml'); 418 $this->assertHeader('Content-Type','application/xml'); 419 $this->assertTextMatch('<hello>business</hello>'); 420 $this->assertHeader('X-Cached-By','Akelos'); 421 422 $this->get('http://www.example.com/page_caching/format.csv'); 423 $this->assertHeader('Content-Type','text/csv'); 424 $this->assertTextMatch('hello,business'); 425 426 $this->_assertPageCached('/page_caching/format'); 427 $this->_assertPageCached('/page_caching/format.html'); 428 $this->_assertPageCached('/page_caching/format.xml'); 429 $this->_assertPageCached('/page_caching/format.csv'); 430 431 $this->get('http://www.example.com/page_caching/format.csv'); 432 $this->assertHeader('Content-Type','text/csv'); 433 $this->assertTextMatch('hello,business'); 434 $this->assertHeader('X-Cached-By','Akelos'); 435 436 } 391 437 } trunk/test/unit/lib/AkActionController/_respond_to_format.php
r1067 r1185 17 17 18 18 } 19 function test_xml_format_with_accept_header() 20 { 21 $_SERVER['HTTP_ACCEPT'] = 'application/xml'; 22 $this->get('http://www.example.com/people/listing'); 23 $this->assertHeader('Content-Type','application/xml'); 24 25 } 19 26 function test_xml_format() 20 27 { trunk/test/unit/lib/AkActionController/_sweeper.php
r897 r1185 93 93 $this->post('http://www.example.com/cache_sweeper/delete/'.$this->userId,array('first_name'=>'Max Schmidt')); 94 94 $this->assertResponse(200); 95 $this->get('http://www.example.com/page_caching/'); 95 96 $this->_assertCacheExists('/'.Ak::lang().'/cache_sweeper/show/'.$this->userId,array('host'=>'www.example.com')); 96 97 … … 116 117 */ 117 118 $this->post('http://www.example.com/cache_sweeper2/delete/'.$this->userId); 119 $this->get('http://www.example.com/page_caching/'); 118 120 $this->_assertCacheExists('/'.Ak::lang().'/cache_sweeper2/show/'.$this->userId,array('host'=>'www.example.com')); 119 121 /** trunk/test/unit/lib/AkActionView/helpers/cache_helper.php
r1168 r1185 66 66 function _test_cache_with_string_key($class) 67 67 { 68 ob_start(); 68 69 if (!$this->cache_helper->begin($this->fragment_key)) { 69 70 $this->assertTrue(true); 70 71 echo $this->fragment_text; 71 $this->cache_helper->end($this->fragment_key);72 echo $this->cache_helper->end($this->fragment_key); 72 73 } else { 73 74 $this->assertFalse(true,'Should not have been cached: ' . $class); 74 75 } 76 $contents = ob_get_clean(); 75 77 $fragment = $this->controller->readFragment($this->fragment_key); 76 78 $this->assertEqual($this->fragment_text, $fragment); 79 $this->assertEqual($this->fragment_text, $contents); 77 80 } 78 81 … … 83 86 $this->assertFalse(true,'Should have been cached: ' . $class); 84 87 echo $this->fragment_text; 85 $this->cache_helper->end($this->fragment_key);88 echo $this->cache_helper->end($this->fragment_key); 86 89 } else { 87 90 $this->assertTrue(true); trunk/test/unit/lib/AkActiveRecord/_AkActiveRecord_1.php
r513 r1185 133 133 $AkTestField->loadColumnsSettings(); 134 134 // Testing database settings cache on session (this might be changed in a future 135 $this->assertEqual($AkTestField->_columnsSettings,$_SESSION['__activeRecordColumnsSettingsCache']['AkTestField_column_settings']); 135 AkDbSchemaCache::doRefresh(false); 136 $this->assertEqual($AkTestField->_columnsSettings,AkDbSchemaCache::getModelColumnSettings('AkTestField')); 137 AkDbSchemaCache::doRefresh(true); 136 138 } 137 139 trunk/test/unit/lib/AkActiveRecord/_AkActiveRecord_connection_handling.php
r468 r1185 25 25 26 26 $this->assertFalse($Model->establishConnection('not_specified_profile')); 27 $this->assertError("Could not find the database profile 'not_specified_profile' in config/config.php."); 27 $this->assertError("The environment not_specified_profile is not allowed. Allowed environments: setup,testing,development,production"); 28 $this->assertError("Could not find the database profile 'not_specified_profile' in config/database.yml."); 28 29 29 30 $check_default_connection =& AkDbAdapter::getInstance(); trunk/test/unit/lib/AkCache.php
r468 r1185 6 6 7 7 require_once(AK_LIB_DIR.DS.'AkCache.php'); 8 9 defined('AK_TEST_MEMCACHED_CHECKFILE')? null: define('AK_TEST_MEMCACHED_CHECKFILE',AK_TEST_DIR.DS.DS.'unit'.DS.'config'.DS.'memcached'); 10 8 11 9 12 class AkCache_TestCase extends AkUnitTest … … 20 23 $this->resetFrameworkDatabaseTables(); 21 24 } 22 23 function setUp()25 26 function test_all_caches() 24 27 { 25 $this->Cache =& new AkCache(); 28 $cacheHandlers = array('cache_lite'=>1,'akadodbcache'=>2); 29 $memcacheEnabled = $this->_checkIfEnabled(AK_TEST_MEMCACHED_CHECKFILE); 30 if ($memcacheEnabled) { 31 $cacheHandlers['akmemcache'] = 3; 32 } 33 $unitTests = array('_testInit','_test_get_and_save','_testremove', '_Testclean'); 34 35 36 foreach ($cacheHandlers as $class=>$type) { 37 foreach ($unitTests as $test) { 38 unset($this->Cache); 39 $this->Cache =& new AkCache(); 40 $this->$test($type,$class); 41 42 } 43 $this->Cache->clean($this->group); 44 } 26 45 } 27 46 28 function tearDown() 29 { 30 unset($this->Cache); 31 } 32 33 function Testinit() 47 function _testInit($type, $class) 34 48 { 35 49 //No driver is loaded … … 38 52 39 53 //Pear Cache Lite driver is loaded 40 $this->Cache->init(null, 1);41 $this->assertIsA($this->Cache->_driverInstance, 'cache_lite');54 $this->Cache->init(null,$type); 55 $this->assertIsA($this->Cache->_driverInstance,$class); 42 56 43 //AdodbCache database cache driver loaded44 $this->Cache->init(null,2);45 $this->assertIsA($this->Cache->_driverInstance,'akadodbcache');46 57 } 47 58 48 function Test_get_and_save()59 function _test_get_and_save($type, $class) 49 60 { 50 61 … … 55 66 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving on the file cache must not work because cache is disabled'); 56 67 57 //Cache Lite cache 58 $this->Cache->init(1,1); 68 $this->Cache->init(2,$type); 59 69 $data = $this->Cache->get($this->id, $this->group); 60 $this->assertFalse($data,'This id must not be in the cache ( File based)');61 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving the cache ( File based)');62 $this->Cache->init( 1,1);70 $this->assertFalse($data,'This id must not be in the cache (Cache class:'.$class.')'); 71 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving the cache (Cache class:'.$class.')'); 72 $this->Cache->init(2,$type); 63 73 $data = $this->Cache->get($this->id, $this->group); 64 $this->assertEqual($data, $this->text_to_catch,'Getting cached data ( File based)');65 sleep( 2);66 $this->Cache->init( 1,1);74 $this->assertEqual($data, $this->text_to_catch,'Getting cached data (Cache class:'.$class.')'); 75 sleep(4); 76 $this->Cache->init(2,$type); 67 77 $data = $this->Cache->get($this->id, $this->group); 68 $this->assertFalse($data,'The cache has expired and we recognize it (File based)'); 69 70 71 72 // Database cache 73 $this->Cache->init(1,2); 74 $data = $this->Cache->get($this->id, $this->group); 75 $this->assertFalse($data,'This id must not be in the cache (Database based)'); 76 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving the cache (Database based)'); 77 $this->Cache->init(1,2); 78 $data = $this->Cache->get($this->id, $this->group); 79 $this->assertEqual($data, $this->text_to_catch,'Getting cached data (Database based)'); 80 sleep(2); 81 $this->Cache->init(1,2); 82 $data = $this->Cache->get($this->id, $this->group); 83 $this->assertFalse($data,'The cache has expired and we recognize it (Database based)'); 78 $this->assertFalse($data,'The cache has expired and we recognize it (Cache class:'.$class.')'); 84 79 85 80 86 81 } 87 82 88 function Testremove()83 function _testremove($type,$class) 89 84 { 90 85 … … 92 87 $this->assertFalse(!$this->Cache->remove($this->id, $this->group),'Removing cached file (Cache disabled must return success)'); 93 88 94 //Cache Lite cache 95 $this->Cache->init(1,1); 96 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving the cache (File based)'); 97 $this->Cache->init(1,1); 89 $this->Cache->init(3,$type); 90 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving the cache (Cache class:'.$class.')'); 91 $this->Cache->init(2,$type); 98 92 $data = $this->Cache->get($this->id, $this->group); 99 $this->assertEqual($data, $this->text_to_catch,'Checking that cached data has been inserted ( File based)');100 $this->assertFalse(!$this->Cache->remove($this->id, $this->group),'Removing cached file ( File based)');93 $this->assertEqual($data, $this->text_to_catch,'Checking that cached data has been inserted (Cache class:'.$class.')'); 94 $this->assertFalse(!$this->Cache->remove($this->id, $this->group),'Removing cached file (Cache class:'.$class.')'); 101 95 $data = $this->Cache->get($this->id, $this->group); 102 $this->assertFalse($data,'The cache must have been removed at this point but stills here ( File based)');96 $this->assertFalse($data,'The cache must have been removed at this point but stills here (Cache class:'.$class.')'); 103 97 104 98 105 //Database cache106 $this->Cache->init(1,2);107 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving the cache (Database based)');108 $this->Cache->init(1,2);109 $data = $this->Cache->get($this->id, $this->group);110 $this->assertEqual($data, $this->text_to_catch,'Checking that cached data has been inserted (Database based)');111 $this->Cache->remove($this->id, $this->group);112 $data = $this->Cache->get($this->id, $this->group);113 $this->assertFalse($data,'The cache must have been removed at this point but stills here (Database based)');114 99 115 100 } 116 101 117 function Testclean()102 function _Testclean($type, $class) 118 103 { 119 104 120 105 //AkCache::clean($group = 'false', $mode = 'ingroup'); 121 $this->Cache->init( 1,1);122 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving on the file cache');123 $this->Cache->init( 1,1);106 $this->Cache->init(null,$type); 107 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving ('.$class.' based)'); 108 $this->Cache->init(null,$type); 124 109 $data = $this->Cache->get($this->id, $this->group); 125 $this->assertEqual($data, $this->text_to_catch,'Checking that cached data has been inserted ( Filebased)');110 $this->assertEqual($data, $this->text_to_catch,'Checking that cached data has been inserted ('.$class.' based)'); 126 111 127 $this->Cache->init( 1,1);128 $this->assertFalse(!$this->Cache->clean($this->group),'Removing all the items in cache ');112 $this->Cache->init(null,$type); 113 $this->assertFalse(!$this->Cache->clean($this->group),'Removing all the items in cache('.$class.' based)'); 129 114 130 $this->Cache->init( 1,1);115 $this->Cache->init(null,$type); 131 116 $data = $this->Cache->get($this->id, $this->group); 132 $this->assertFalse($data,'The cache must have been removed at this point but stills here ');117 $this->assertFalse($data,'The cache must have been removed at this point but stills here('.$class.' based)'); 133 118 134 135 136 //AkCache::clean($group = 'false', $mode = 'ingroup');137 $this->Cache->init(1,2);138 $this->assertFalse(!$this->Cache->save($this->text_to_catch, $this->id, $this->group),'saving on the file cache');139 $this->Cache->init(1,2);140 $data = $this->Cache->get($this->id, $this->group);141 $this->assertEqual($data, $this->text_to_catch,'Checking that cached data has been inserted (File based)');142 143 $this->Cache->init(1,2);144 $this->assertFalse(!$this->Cache->clean($this->group),'Removing all the items in cache');145 146 $this->Cache->init(1,2);147 $data = $this->Cache->get($this->id, $this->group);148 $this->assertFalse($data,'The cache must have been removed at this point but stills here');149 119 150 120 } trunk/test/unit/lib/AkInflector.php
r659 r1185 5 5 6 6 require_once(AK_LIB_DIR.DS.'AkInflector.php'); 7 8 7 9 8 class Test_of_AkInflector extends UnitTestCase … … 315 314 $this->assertEqual(AkInflector::toControllerFilename('admin/users'), AK_CONTROLLERS_DIR.DS.'admin'.DS.'users_controller.php'); 316 315 } 316 function test_singularize_singular() 317 { 318 $this->assertEqual('resize',AkInflector::singularize('resize')); 319 } 320 function test_simple_tableize() 321 { 322 $this->assertEqual('Pictures',AkInflector::pluralize('Picture')); 323 $this->assertEqual('pictures',AkInflector::tableize('picture')); 324 } 325 function test_spanish_dictionary() 326 { 327 $this->assertNotEqual('tijeras',AkInflector::singularize('tijeras')); 328 $this->assertEqual('tijeras',AkInflector::singularize('tijeras',null,'es')); 329 $this->assertEqual('ingleses',AkInflector::pluralize('inglés',null,'es')); 330 } 317 331 } 318 332 trunk/test/unit/lib/AkTestApplication.php
r1154 r1185 44 44 } 45 45 46 function test_assert_xpath()46 function x_test_assert_xpath() 47 47 { 48 48 $test_app = new MockTestApplication();
