Skip to content
Permalink
Browse files

Removing repeated checks, as they've been refactored into Cache::incr…

…ement() and Cache::decrement().

Adding skipIf()'s to ApcEngineTest in case apc_inc, and apc_dec are not available.
  • Loading branch information...
markstory committed Jan 21, 2010
1 parent ff7e906 commit 513db9a72a97da6bc0239e505c955663415fb372
Showing with 9 additions and 15 deletions.
  1. +0 −6 cake/libs/cache/apc.php
  2. +0 −6 cake/libs/cache/xcache.php
  3. +9 −3 cake/tests/cases/libs/cache/apc.test.php
@@ -84,9 +84,6 @@ function read($key) {
* @access public
*/
function increment($key, $offset = 1) {
if (!is_integer($offset) || $offset < 0) {
return false;
}
return apc_inc($key, $offset);
}
@@ -100,9 +97,6 @@ function increment($key, $offset = 1) {
* @access public
*/
function decrement($key, $offset = 1) {
if (!is_integer($offset) || $offset < 0) {
return false;
}
return apc_dec($key, $offset);
}
@@ -101,9 +101,6 @@ function read($key) {
* @access public
*/
function increment($key, $offset = 1) {
if (!is_integer($offset) || $offset < 0) {
return false;
}
return xcache_inc($key, $offset);
}
@@ -118,9 +115,6 @@ function increment($key, $offset = 1) {
* @access public
*/
function decrement($key, $offset = 1) {
if (!is_integer($offset) || $offset < 0) {
return false;
}
return xcache_dec($key, $offset);
}
/**
@@ -27,7 +27,7 @@
* @package cake
* @subpackage cake.tests.cases.libs.cache
*/
class ApcEngineTest extends UnitTestCase {
class ApcEngineTest extends CakeTestCase {
/**
* skip method
@@ -147,7 +147,10 @@ function testDeleteCache() {
* @access public
* @return void
*/
public function testDecrement() {
function testDecrement() {
if ($this->skipIf(!function_exists('apc_dec'), 'No apc_dec() function, cannot test decrement() %s')) {
return;
}
$result = Cache::write('test_decrement', 5);
$this->assertTrue($result);
@@ -171,7 +174,10 @@ public function testDecrement() {
* @access public
* @return void
*/
public function testIncrement() {
function testIncrement() {
if ($this->skipIf(!function_exists('apc_inc'), 'No apc_inc() function, cannot test increment() %s')) {
return;
}
$result = Cache::write('test_increment', 5);
$this->assertTrue($result);

0 comments on commit 513db9a

Please sign in to comment.
You can’t perform that action at this time.