From 1230434e16d05f47993fbad580627fc2b0d48f04 Mon Sep 17 00:00:00 2001 From: Timothy J Warren Date: Wed, 1 Mar 2017 10:01:20 -0500 Subject: [PATCH] Another attempt to fix apcu tests --- build/phpunit.xml | 1 - src/Driver/ApcuDriver.php | 23 ++++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/build/phpunit.xml b/build/phpunit.xml index 2b3fd26..cda881d 100644 --- a/build/phpunit.xml +++ b/build/phpunit.xml @@ -4,7 +4,6 @@ stopOnFailure="false" bootstrap="../tests/bootstrap.php" beStrictAboutTestsThatDoNotTestAnything="true" - checkForUnintentionallyCoveredCode="true" > diff --git a/src/Driver/ApcuDriver.php b/src/Driver/ApcuDriver.php index b4f5c33..78e81ae 100644 --- a/src/Driver/ApcuDriver.php +++ b/src/Driver/ApcuDriver.php @@ -51,7 +51,7 @@ class ApcuDriver extends AbstractDriver { */ public function exists(string $key): bool { - return \apcu_exists($key) !== FALSE; + return apcu_exists($key) !== FALSE; } /** @@ -62,7 +62,7 @@ class ApcuDriver extends AbstractDriver { */ public function get(string $key) { - return \apcu_fetch($key); + return apcu_fetch($key); } /** @@ -94,13 +94,13 @@ class ApcuDriver extends AbstractDriver { */ public function set(string $key, $value, int $expires = 0): DriverInterface { - if ( ! \apcu_exists($key)) + if ( ! apcu_exists($key)) { - \apcu_add($key, $value, $expires); + apcu_add($key, $value, $expires); } else { - \apcu_store($key, $value, $expires); + apcu_store($key, $value, $expires); } return $this; @@ -114,7 +114,7 @@ class ApcuDriver extends AbstractDriver { */ public function delete(string $key): bool { - return \apcu_delete($key); + return apcu_delete($key); } /** @@ -125,7 +125,7 @@ class ApcuDriver extends AbstractDriver { */ public function deleteMultiple(array $keys = []): bool { - return \apcu_delete($keys); + return apcu_delete($keys); } /** @@ -137,13 +137,10 @@ class ApcuDriver extends AbstractDriver { { if (function_exists('apcu_clear_cache')) { - return \apcu_clear_cache(); + return apcu_clear_cache(); } - if (function_exists('apc_clear_cache')) - { - return \apc_clear_cache(); - } + return TRUE; } /** @@ -158,7 +155,7 @@ class ApcuDriver extends AbstractDriver { if ($this->exists($key)) { $value = $this->get($key); - return \apcu_store($key, $value, $expires); + return apcu_store($key, $value, $expires); } $this->getLogger()->warn("Tried to set expiration on a key that does not exist");