Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 513db9a72a97da6bc0239e505c955663415fb372 1 parent ff7e906
@markstory markstory authored
View
6 cake/libs/cache/apc.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);
}
View
6 cake/libs/cache/xcache.php
@@ -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);
}
/**
View
12 cake/tests/cases/libs/cache/apc.test.php
@@ -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);
Please sign in to comment.
Something went wrong with that request. Please try again.