Skip to content

Commit

Permalink
Fixes improper return from Xcache::clear();
Browse files Browse the repository at this point in the history
Adds test
see #6110

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8046 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information
TommyO authored and TommyO committed Feb 18, 2009
1 parent 0beda26 commit 96e84c2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cake/libs/cache/xcache.php
Expand Up @@ -107,12 +107,12 @@ function delete($key) {
*/
function clear() {
$this->__auth();
for ($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
$max = xcache_count(XC_TYPE_VAR);
for ($i = 0; $i < $max; $i++) {
xcache_clear_cache(XC_TYPE_VAR, $i);
}
$result = xcache_count(XC_TYPE_VAR) == 0;
$this->__auth(true);
return $result;
return true;
}
/**
* Populates and reverses $_SERVER authentication values
Expand Down
17 changes: 17 additions & 0 deletions cake/tests/cases/libs/cache/xcache.test.php
Expand Up @@ -139,6 +139,23 @@ function testDeleteCache() {
$result = Cache::delete('delete_test');
$this->assertTrue($result);
}
/**
* testClearCache method
*
* @access public
* @return void
*/
function testClearCache() {
$data = 'this is a test of the emergency broadcasting system';
$result = Cache::write('clear_test_1', $data);
$this->assertTrue($result);

$result = Cache::write('clear_test_2', $data);
$this->assertTrue($result);

$result = Cache::clear();
$this->assertTrue($result);
}
/**
* tearDown method
*
Expand Down

0 comments on commit 96e84c2

Please sign in to comment.