Changeset 948
- Timestamp:
- 07/24/08 06:40:11 (3 months ago)
- Files:
-
- branches/arnoschn/cache (modified) (1 prop)
- branches/arnoschn/cache/CiReportTask.php (added)
- branches/arnoschn/cache/CiRewriteUrlTask.php (added)
- branches/arnoschn/cache/CiTestsTask.php (modified) (5 diffs)
- branches/arnoschn/cache/TPL-build.properties (added)
- branches/arnoschn/cache/build-test.xml (modified) (1 diff)
- branches/arnoschn/cache/lib/Ak.php (modified) (1 diff)
- branches/arnoschn/cache/script/extras/DEFAULT-mysql-testing.php (modified) (1 diff)
- branches/arnoschn/cache/script/extras/TPL-ci-config.yaml (added)
- branches/arnoschn/cache/script/extras/TPL-config-testing.php (added)
- branches/arnoschn/cache/script/extras/TPL-fix_htaccess.php (added)
- branches/arnoschn/cache/script/extras/xinc-ci_tests.php (modified) (2 diffs)
- branches/arnoschn/cache/script/setup (modified) (6 diffs)
- branches/arnoschn/cache/test (modified) (1 prop)
- branches/arnoschn/cache/test/unit/lib/AkActionView/helpers/cache_helper.php (modified) (3 diffs)
- branches/arnoschn/cache/test/unit/lib/AkCache/AkMemcache.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/arnoschn/cache
- Property svn:ignore deleted
branches/arnoschn/cache/CiTestsTask.php
r929 r948 7 7 var $_apacheUser = 'www-data'; 8 8 var $_apacheGroup = 'www-data'; 9 var $_testDir; 10 var $_args; 9 11 public function setAkelosPath($path) 10 12 { 11 13 $this->_akelosPath = $path; 12 14 } 15 public function setArgs($args) 16 { 17 $this->_args = $args; 18 } 13 19 20 public function setTestDir($dir) 21 { 22 $this->_testDir = $dir; 23 } 14 24 public function setApacheGroup($group) 15 25 { … … 22 32 public function main() 23 33 { 34 24 35 $this->_installTestApp(); 25 36 $this->_copyFiles(); … … 29 40 private function _runTests() 30 41 { 31 chdir($this->_ akelosPath.DS.$this->_testPath);32 $this->_execute(' chgrp -R ' .$this->_apacheGroup.' ' .$this->_akelosPath.DS.$this->_testPath);33 $this->_execute('chown -R ' .$this->_apacheUser.' ' .$this->_akelosPath.DS.$this->_testPath);34 $this->_execute(' export AK_FRAMEWORK_DIR="'.$this->_akelosPath.'";/usr/bin/env php '.$this->_akelosPath.DS.$this->_testPath.'/script/extras/xinc-ci_tests.php',true);42 chdir($this->_testDir); 43 $this->_execute('rm -Rf ' .$this->_testDir.'/test-results*.xml'); 44 //$this->_execute('chown -R ' .$this->_apacheUser.' ' .$this->_akelosPath.DS.$this->_testPath); 45 $this->_execute('/usr/bin/env php '.$this->_testDir.'/script/extras/xinc-ci_tests.php '.$this->_args,true); 35 46 } 36 47 … … 38 49 { 39 50 !defined('DS')?define('DS',DIRECTORY_SEPARATOR):null; 40 //passthru('rm -Rf '.$this->_testPath); 41 $excludeTestPath = basename($this->_testPath).' nanoweb'; 42 //mkdir($this->_testPath,0777,true); 43 $this->_execute($this->_akelosPath.'/akelos -d '.$this->_testPath.' --force -e '.$excludeTestPath,true); 44 //$this->_execute('rm -Rf '.$this->_testPath.DS.'app'.DS.'* ',true); 45 //$this->_execute('rm -Rf '.$this->_testPath.DS.'public'.DS.'* ',true); 46 //$this->_execute("cp -Rf ".$this->_akelosPath.DS.'test'.DS.'fixtures'.DS.'app'." ".$this->_testPath.DS, true); 47 //$this->_execute("cp -Rf ".$this->_akelosPath.DS.'test'.DS.'fixtures'.DS.'public'." ".$this->_testPath.DS, true); 48 $this->_execute("touch ".$this->_testPath.DS.'log'.DS."testing.log", true); 49 $this->_execute("chmod 777 ".$this->_testPath.DS.'log'.DS."testing.log", true); 50 $this->_execute("cp -Rf ".$this->_akelosPath.DS.'test'." ".$this->_testPath.DS, true); 51 $this->_execute("cp ".$this->_akelosPath.DS.'test'.DS.'.nwaccess'." ".$this->_testPath.DS, true); 52 $this->_execute("find ".$this->_testPath.DS."/ -type d -name '.svn' -exec sh -c 'exec rm -Rf \"$@\"' find-copy {} +",true); 53 //$this->_execute("cp -Rf ".$this->_akelosPath.DS.'tmp'.DS.'installer_versions'." ".$this->_testPath.DS.'test'.DS.'tmp', true); 54 //$this->_execute("cp -Rf ".$this->_akelosPath.DS.'tmp'.DS.'installer_versions'." ".$this->_testPath.DS.'tmp', true); 55 //$this->_execute("cp -Rf ".$this->_akelosPath.DS.'test'.DS.'suites'." ".$this->_testPath.DS.'test'.DS, true); 51 $this->_execute($this->_akelosPath.'/akelos -d '.$this->_testDir.' -deps --force',true); 52 $this->_execute("touch ".$this->_testDir.DS.'log'.DS."testing.log", true); 53 $this->_execute("chmod 777 ".$this->_testDir.DS.'log'.DS."testing.log", true); 54 $this->_execute("cp -Rf ".$this->_akelosPath.DS.'test'." ".$this->_testDir.DS, true); 55 $this->_execute("cp ".$this->_akelosPath.DS.'test'.DS.'.nwaccess'." ".$this->_testDir.DS, true); 56 //$this->_execute("find ".$this->_testDir.DS."/ -type d -name '.svn' -exec sh -c 'exec rm -Rf \"$@\"' find-copy {} +",true); 56 57 } 57 58 private function _execute($cmd,$execute=true) … … 78 79 79 80 foreach ($files as $file=>$dest) { 80 $this->_execute('cp '.(isset($dest[1])?$dest[1]:'').' '.$this->_akelosPath.DIRECTORY_SEPARATOR.$file.' '.$this->_test Path.DIRECTORY_SEPARATOR.$dest[0].DIRECTORY_SEPARATOR.basename($file));81 $this->_execute('cp '.(isset($dest[1])?$dest[1]:'').' '.$this->_akelosPath.DIRECTORY_SEPARATOR.$file.' '.$this->_testDir.DIRECTORY_SEPARATOR.$dest[0].DIRECTORY_SEPARATOR.basename($file)); 81 82 } 82 83 branches/arnoschn/cache/build-test.xml
r931 r948 2 2 <project name="LP2 Build File For Unit Tests" basedir="." default="build"> 3 3 4 <property name="report.dir" value="report" /> 5 <property name="codecoverage" value="false" override="true" /> 6 <property name="coverage.dir" value="report/coverage" /> 7 <property name="coverage.subdir" value="coverage" /> 8 9 <property name="coverage.database" value="./report/coverage/database" /> 4 <property file="build.properties"/> 5 <property name="report.dir" value="${project.basedir}/test/report" /> 6 <property name="test.dir" value="${project.basedir}/ci-tests" /> 7 <property name="config.dir" value="${project.basedir}/script/extras" /> 8 <property name="config.file" value="${config.dir}/ci-config.yaml" /> 10 9 <fileset dir="lib" id="akelos-classes"> 11 10 <include name="*/**/*.php" /> 12 11 </fileset> 12 13 <target name="taskdef"> 14 <taskdef name="ci-tests" classname="CiTestsTask" classpath="${project.basedir}" /> 15 <taskdef name="ci-reports" classname="CiReportTask" classpath="${project.basedir}" /> 16 <taskdef name="ci-rewrite-url" classname="CiRewriteUrlTask" classpath="${project.basedir}" /> 17 </target> 18 19 <target name="interactive" depends="taskdef,check-config"> 20 <if> 21 <equals arg1="${akelos_path}" arg2="" /> 22 <then> 23 <property name="akelos_path" value="${project.basedir}" override="true" /> 24 </then> 25 </if> 26 <if> 27 <equals arg1="${test_dir}" arg2="" /> 28 <then> 29 <property name="test_dir" value="${test.dir}" override="true" /> 30 </then> 31 </if> 32 <echo> 33 params: 34 all 35 36 run all unit tests in any combination. 37 38 params: 39 php5 postgres mysql AkHasMany AkBelongsTo 40 41 run AkHasMany and AkBelongsTo on PHP5 using the postgres and mysql-db. 42 </echo> 43 <input propertyname="akelos_path" message="Please provide the akelos path containing the version you want to test" promptChar=":" defaultValue="${akelos_path}" /> 44 <input propertyname="test_dir" message="Please provide the directory the test app should be installed in" promptChar=":" defaultValue="${test_dir}" /> 45 <input propertyname="arguments" message="Please provide run arguments. No arguments will run all valid combinations" promptChar=":" defaultValue="${arguments}" /> 46 <phingCall target="run-tests"> 47 <param name="akelos_path" value="${akelos_path}" /> 48 <param name="test_dir" value="${test_dir}" /> 49 <param name="arguments" value="${arguments}" /> 50 </phingCall> 51 </target> 52 <target name="validate-akelos"> 53 <available file="${akelos_path}/akelos" property="akelos_available" /> 54 <fail unless="akelos_available" message="akelos could not be found in ${akelos_path}" /> 55 </target> 56 57 <target name="run-tests"> 58 <copy file="TPL-build.properties" tofile="build.properties" overwrite="true"> 59 <filterchain> 60 <expandproperties /> 61 </filterchain> 62 </copy> 63 <phingCall target="validate-akelos" /> 64 <ci-tests akelosPath="${akelos_path}" testDir="${test_dir}" args="${arguments}" /> 65 <phingCall target="generate-reports"> 66 <param name="test.dir" value="${test_dir}" /> 67 </phingCall> 68 </target> 69 <target name="generate-reports"> 70 <ci-reports styledir="resources/xsl" reportdir="${report.dir}" format="noframes"> 71 <fileset dir="${test.dir}"> 72 <include name="test-results*.xml" /> 73 </fileset> 74 75 </ci-reports> 76 </target> 77 78 <target name="check-config"> 79 <echo>Checking configuration</echo> 80 <available file="${config.file}" property="config.exists" value="1" /> 81 <if> 82 <equals arg1="${config.exists}" arg2="1" /> 83 <then> 84 <echo>${config.file} exists</echo> 85 </then> 86 <else> 87 <echo>${config.file} does not exist</echo> 88 <phingCall target="generate-config" /> 89 90 </else> 91 </if> 92 </target> 13 93 94 <target name="setup" depends="taskdef,generate-config"/> 95 <target name="generate-config"> 96 <echo>Generating config</echo> 97 <input propertyname="testing.url" message="[WebServer] Please provide the url under which the testing website can be found" promptChar=":" defaultValue="http://localhost/test/fixtures/public" /> 98 <phingCall target="generate-config-mysql"> 99 <param name="testing.url" value="${testing.url}" /> 100 </phingCall> 101 <phingCall target="generate-config-postgres"> 102 <param name="testing.url" value="${testing.url}" /> 103 </phingCall> 104 <phingCall target="generate-config-sqlite"> 105 <param name="testing.url" value="${testing.url}" /> 106 </phingCall> 107 <phingCall target="generate-yaml-config-file" /> 108 <phingCall target="generate-fix-htaccess" /> 109 </target> 110 <target name="generate-config-mysql"> 111 <phingCall target="generate-config-file"> 112 <param name="type" value="mysql" /> 113 114 <param name="testing.url" value="${testing.url}" /> 115 </phingCall> 116 </target> 117 <target name="generate-config-postgres"> 118 <phingCall target="generate-config-file"> 119 <param name="type" value="postgres" /> 120 121 <param name="testing.url" value="${testing.url}" /> 122 </phingCall> 123 </target> 124 <target name="generate-config-sqlite"> 125 <phingCall target="generate-config-file"> 126 <param name="type" value="sqlite" /> 127 <param name="file.based" value="1" /> 128 <param name="testing.url" value="${testing.url}" /> 129 </phingCall> 130 </target> 131 <target name="generate-config-file"> 132 133 <if> 134 <equals arg1="${file.based}" arg2="1" /> 135 <then> 136 <input propertyname="file" message="[${type}] Please provide which database-file should be used" promptChar=":" defaultValue="" /> 137 <property name="database" value="" /> 138 <property name="host" value="" /> 139 <property name="user" value="" /> 140 <property name="password" value="" /> 141 </then> 142 143 <else> 144 <input propertyname="host" message="[${type}] Please provide which host should be used" promptChar=":" defaultValue="localhost" /> 145 <property name="file" value="" /> 146 <input propertyname="database" message="[${type}] Please provide which database should be used" promptChar=":" defaultValue="framework_tests" /> 147 <input propertyname="user" message="[${type}] Please provide which user should be used" promptChar=":" defaultValue="akelos" /> 148 <input propertyname="password" message="[${type}] Please provide which password should be used" promptChar=":" /> 149 </else> 150 </if> 151 152 153 <copy file="${config.dir}/TPL-config-testing.php" tofile="${config.dir}/${type}-testing.php" overwrite="true"> 154 <filterchain> 155 <expandproperties /> 156 </filterchain> 157 </copy> 158 </target> 159 <target name="generate-fix-htaccess"> 160 <ci-rewrite-url url="${testing.url}" property="rewrite.url"/> 161 <copy file="${config.dir}/TPL-fix_htaccess.php" tofile="${config.dir}/fix_htaccess.php" overwrite="true"> 162 <filterchain> 163 <expandproperties /> 164 </filterchain> 165 </copy> 166 </target> 167 <target name="generate-yaml-config-file"> 168 169 <input propertyname="php5" message="Please provide the path to the php5 executable" promptChar=":" defaultValue="/usr/bin/php5" /> 170 <input propertyname="php4" message="Please provide the path to the php4 executable" promptChar=":" defaultValue="/usr/bin/php4" /> 171 172 173 <copy file="${config.dir}/TPL-ci-config.yaml" tofile="${config.dir}/ci-config.yaml" overwrite="true"> 174 <filterchain> 175 <expandproperties /> 176 </filterchain> 177 </copy> 178 </target> 14 179 <target name="prepare"> 15 180 16 181 <mkdir dir="${report.dir}" /> 17 <mkdir dir="${ project.basedir}/ci-tests" />182 <mkdir dir="${test.dir}" /> 18 183 </target> 19 184 20 <target name="generate-report"> 21 <mkdir dir="${report.dir}/${phpversion}" /> 22 <mkdir dir="${report.dir}/${phpversion}/${environment}" /> 23 <phpunit2report infile="${project.basedir}/ci-tests/test-results-${phpversion}-${environment}.xml" styledir="resources/xsl" todir="${report.dir}/${phpversion}/${environment}" format="noframes" /> 24 25 </target> 26 <target name="test"> 27 <taskdef name="ci-tests" classname="CiTestsTask" classpath="${project.basedir}" /> 28 <copy todir="${project.basedir}/tmp"> 29 <filterchain> 30 <expandproperties /> 31 </filterchain> 32 <fileset dir="${project.basedir}/test/nanoweb/etc"> 33 <include name="nanoweb.conf" /> 34 <include name="modules.conf" /> 35 </fileset> 36 </copy> 37 <exec command='${project.basedir}/test/nanoweb/bin/nanoweb.php --config=${project.basedir}/tmp/nanoweb.conf --set-option="PidFile=${project.basedir}/tmp/nanoweb.pid"' spawn="true" passthru="true"/> 38 <ci-tests akelosPath="${project.basedir}" /> 39 <exec command="kill `cat ${project.basedir}/tmp/nanoweb.pid` >/dev/null 2>/dev/null"/> 40 <exec command="rm ${project.basedir}/tmp/nanoweb.pid"/> 41 </target> 42 43 <target name="report"> 44 <phingCall target="generate-report"> 45 <property name="phpversion" value="php5" /> 46 <property name="environment" value="mysql" /> 47 </phingCall> 48 <phingCall target="generate-report"> 49 <property name="phpversion" value="php4" /> 50 <property name="environment" value="mysql" /> 51 </phingCall> 52 <phingCall target="generate-report"> 53 <property name="phpversion" value="php5" /> 54 <property name="environment" value="postgres" /> 55 </phingCall> 56 <phingCall target="generate-report"> 57 <property name="phpversion" value="php4" /> 58 <property name="environment" value="postgres" /> 59 </phingCall> 60 <phingCall target="generate-report"> 61 <property name="phpversion" value="php5" /> 62 <property name="environment" value="sqlite" /> 63 </phingCall> 64 </target> 65 66 <target name="build" depends="prepare,test,report"> 185 <target name="build" depends="taskdef,check-config,run-tests"> 67 186 </target> 68 187 branches/arnoschn/cache/lib/Ak.php
r929 r948 358 358 if(!$result = file_put_contents($options['base_path'].DS.$file_name, $content)){ 359 359 if(!empty($content)){ 360 Ak::trace(" Please change file/dir permissions or enable FTP file handling by".360 Ak::trace("Could not write to file: \"".$options['base_path'].DS."$file_name\". Please change file/dir permissions or enable FTP file handling by". 361 361 " setting the following on your config/".AK_ENVIRONMENT.".php file \n<pre>define('AK_UPLOAD_FILES_USING_FTP', true);\n". 362 362 "define('AK_READ_FILES_USING_FTP', false);\n". branches/arnoschn/cache/script/extras/DEFAULT-mysql-testing.php
r933 r948 6 6 'host' => 'localhost', 7 7 'database_name' => 'framework_tests', 8 'user' => ' ',9 'password' => ' ',8 'user' => 'arno', 9 'password' => 'arno', 10 10 'options' => '' 11 11 )); 12 12 13 13 $database_settings['development'] = $database_settings['production'] = $database_settings['testing']; 14 defined('DS') ? null : define('DS', DIRECTORY_SEPARATOR); 14 15 15 defined('AK_ENVIRONMENT') ? null : define('AK_ENVIRONMENT', 'testing'); 16 16 defined('AK_BASE_DIR') ? null : define('AK_BASE_DIR', str_replace(DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php','',__FILE__)); 17 defined('AK_FRAMEWORK_DIR') ? null : define('AK_FRAMEWORK_DIR', str_replace(DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php',DS.'..'.DS,__FILE__)); 18 defined('AK_TESTING_URL') ? null : define('AK_TESTING_URL', 'http://localhost:8181/test/fixtures/public'); 17 defined('AK_TESTING_URL') ? null : define('AK_TESTING_URL', 'http://localhost:81/test/fixtures/public'); 19 18 define('AK_LOG_EVENTS', true); 20 defined('AK_TMP_DIR') ? null : define('AK_TMP_DIR', AK_BASE_DIR.DS.'test'.DS.'tmp'); 19 21 20 include('fix_htaccess.php'); 22 21 branches/arnoschn/cache/script/extras/xinc-ci_tests.php
r929 r948 40 40 function loadSettings($filename=AK_CI_CONFIG_FILE) 41 41 { 42 require dirname(__FILE__).DS.'..'.DS.'..'.DS.' ..'.DS.'vendor'.DS.'TextParsers'.DS.'spyc.php';42 require dirname(__FILE__).DS.'..'.DS.'..'.DS.'vendor'.DS.'TextParsers'.DS.'spyc.php'; 43 43 44 44 if (!is_file($filename)){ … … 52 52 { 53 53 array_shift($args); 54 54 55 while (count($args) > 0){ 55 56 $arg = array_shift($args); branches/arnoschn/cache/script/setup
r929 r948 31 31 'quiet' => false, 32 32 'public_html' => false, 33 'exclude' => false,34 33 'dependencies' => false 35 34 ); … … 55 54 } 56 55 } 57 if(!empty($this->options['exclude'])){ 58 $this->framework_dirs = array('lib', 'vendor', 'test'); 59 $excludes = !is_array($this->options['exclude'])?array($this->options['exclude']):$this->options['exclude']; 60 foreach ($excludes as $exclude_dir){ 61 foreach ($this->source_tree as $k => $v){ 62 if(isset($v[$exclude_dir])){ 63 unset($this->source_tree[$k]) ; 64 } 65 } 66 } 67 } 56 68 57 $this->destination_tree = Ak::dir($this->options['directory'],array('dirs'=>true,'recurse'=>true)); 69 58 } … … 103 92 $test_dir = $this->options['directory'].DS.'test'; 104 93 105 $this->_makeDir($test_dir ,true);94 $this->_makeDir($test_dir); 106 95 $this->_copyFile($source_test_dir.DS.'app.php'); 107 96 108 $this->_makeDir($test_dir.DS.'fixtures' ,true);109 $this->_makeDir($test_dir.DS.'fixtures'.DS.'app' ,true);97 $this->_makeDir($test_dir.DS.'fixtures'); 98 $this->_makeDir($test_dir.DS.'fixtures'.DS.'app'); 110 99 111 100 $this->_copyFile($source_test_dir.DS.'fixtures'.DS.'app'.DS.'application_controller.php'); 112 101 $this->_copyFile($source_test_dir.DS.'fixtures'.DS.'app'.DS.'shared_model.php'); 113 102 114 $this->_makeDir($test_dir.DS.'fixtures'.DS.'config' ,true);103 $this->_makeDir($test_dir.DS.'fixtures'.DS.'config'); 115 104 $this->_copyFile($source_test_dir.DS.'fixtures'.DS.'config'.DS.'config.php'); 116 105 117 $this->_makeDir($test_dir.DS.'fixtures'.DS.'data' ,true);118 $this->_makeDir($test_dir.DS.'fixtures'.DS.'public' ,true);106 $this->_makeDir($test_dir.DS.'fixtures'.DS.'data'); 107 $this->_makeDir($test_dir.DS.'fixtures'.DS.'public'); 119 108 $this->_copyFile($source_test_dir.DS.'fixtures'.DS.'public'.DS.'.htaccess'); 120 109 $this->_copyFile($source_test_dir.DS.'fixtures'.DS.'public'.DS.'index.php'); … … 200 189 } 201 190 202 function _makeDir($path, $takeAsIs=false) 203 { 204 if ($takeAsIs) { 205 $dir = $path; 206 } else { 207 $dir = $this->_getDestinationPath($path); 208 } 209 191 function _makeDir($path) 192 { 193 $dir = $this->_getDestinationPath($path); 194 210 195 if($this->_canUsePath($dir)){ 211 196 if(!is_dir($dir)){ … … 214 199 return false; 215 200 } 201 } 202 $source_file_mode = fileperms($path); 203 $target_file_mode = fileperms($dir); 204 if($source_file_mode != $target_file_mode){ 205 $this->yield(" Setting $dir permissions to: ".(sprintf("%o",$source_file_mode))); 206 chmod($dir,$source_file_mode); 216 207 } 217 208 return true; … … 456 447 'desc' => 'Show this help message.'), 457 448 458 'exclude' => array(459 'short' => 'e',460 'max' => -1,461 'min' => 0,462 'desc' => 'Exclude directories when creating the application'),463 449 464 450 ); branches/arnoschn/cache/test
- Property svn:ignore set to
report
- Property svn:ignore set to
branches/arnoschn/cache/test/unit/lib/AkActionView/helpers/cache_helper.php
r897 r948 24 24 $this->cache_helper =& $this->controller->cache_helper; 25 25 26 $this->assertIsA($this->cache_helper,'CacheHelper'); 27 28 26 29 27 30 } … … 37 40 $unitTests = array('_test_cache_with_string_key','_test_cache_with_string_key_cached'); 38 41 39 42 if(is_a($this->controller->_CacheHandler,'AkCacheHandler')) { 40 43 foreach ($cacheHandlers as $class=>$type) { 41 44 $this->controller->_CacheHandler->_setCacheStore($type); … … 44 47 $this->$test($class); 45 48 } 49 } 50 } else { 51 $this->fail('CacheHandler is not initialized. Please enable the caching system for the unit-test'); 46 52 } 47 53 } branches/arnoschn/cache/test/unit/lib/AkCache/AkMemcache.php
r899 r948 15 15 $this->memcache=AkCache::lookupStore($cache_settings); 16 16 $this->assertIsA($this->memcache,'AkCache'); 17 17 18 } 18 19 19 20 function test_init_without_server_fallback_to_default() 20 21 { 22 21 23 $this->memcache=new AkMemcache(); 22 24 $res = $this->memcache->init(array()); … … 49 51 function test_set_and_get_string() 50 52 { 53 if (!is_a($this->memcache,'AkCache')) { 54 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 55 return; 56 } 51 57 $original = 'test'; 52 58 $res = $this->memcache->save($original,'test_id_1','strings'); … … 58 64 function test_set_and_get_integer() 59 65 { 66 if (!is_a($this->memcache,'AkCache')) { 67 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 68 return; 69 } 60 70 $original = 1111; 61 71 $res = $this->memcache->save($original,'test_id_2','integers'); … … 66 76 function test_set_and_get_float() 67 77 { 78 if (!is_a($this->memcache,'AkCache')) { 79 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 80 return; 81 } 68 82 $original = 11.11; 69 83 $res = $this->memcache->save($original,'test_id_3','floats'); … … 74 88 function test_set_and_get_array() 75 89 { 90 if (!is_a($this->memcache,'AkCache')) { 91 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 92 return; 93 } 76 94 $original = array(0,1,2,3,'test'); 77 95 $res = $this->memcache->save($original,'test_id_4','arrays'); … … 83 101 function test_set_and_get_object() 84 102 { 103 if (!is_a($this->memcache,'AkCache')) { 104 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 105 return; 106 } 85 107 $original = new stdClass; 86 108 $original->id = 1; … … 94 116 function test_set_and_get_objects_within_arrays() 95 117 { 118 if (!is_a($this->memcache,'AkCache')) { 119 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 120 return; 121 } 96 122 $obj1=new stdClass; 97 123 $obj1->id=1; … … 109 135 function test_set_and_get_large_strings() 110 136 { 137 if (!is_a($this->memcache,'AkCache')) { 138 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 139 return; 140 } 111 141 $original = file_get_contents(__FILE__); 112 142 $res = $this->memcache->save($original,'test_id_7','largestrings'); … … 118 148 function test_set_and_get_binary_data() 119 149 { 150 if (!is_a($this->memcache,'AkCache')) { 151 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 152 return; 153 } 120 154 $original = file_get_contents(AK_BASE_DIR.DS.'public'.DS.'images'.DS.'akelos_framework_logo.png'); 121 155 $res = $this->memcache->save($original,'test_id_8','binary'); … … 127 161 function test_set_and_get_really_large_string() 128 162 { 163 if (!is_a($this->memcache,'AkCache')) { 164 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 165 return; 166 } 129 167 $original = $this->_generateLargeString(1000000); 130 168 $res = $this->memcache->save($original,'test_id_9','strings'); … … 135 173 function test_set_and_get_really_really_large_string() 136 174 { 175 if (!is_a($this->memcache,'AkCache')) { 176 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 177 return; 178 } 137 179 $original = $this->_generateLargeString(2000000); 138 180 $res = $this->memcache->save($original,'test_id_10','strings'); … … 144 186 function test_set_and_remove_key() 145 187 { 188 if (!is_a($this->memcache,'AkCache')) { 189 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 190 return; 191 } 146 192 $original = $this->_generateLargeString(1000); 147 193 $res = $this->memcache->save($original,'test_id_11','strings'); … … 156 202 function test_flush_group() 157 203 { 204 if (!is_a($this->memcache,'AkCache')) { 205 $this->fail('Caching is not enabled. Please enable caching for the unit test'); 206 return; 207 } 158 208 $retrieved = $this->memcache->get('test_id_10','strings'); 159 209 $this->assertTrue($retrieved!=null);
