Another attempt to fix apcu tests

This commit is contained in:
Timothy Warren 2017-03-01 10:01:20 -05:00
parent 7590184b5f
commit 1230434e16
2 changed files with 10 additions and 14 deletions

View File

@ -4,7 +4,6 @@
stopOnFailure="false" stopOnFailure="false"
bootstrap="../tests/bootstrap.php" bootstrap="../tests/bootstrap.php"
beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTestsThatDoNotTestAnything="true"
checkForUnintentionallyCoveredCode="true"
> >
<filter> <filter>
<whitelist> <whitelist>

View File

@ -51,7 +51,7 @@ class ApcuDriver extends AbstractDriver {
*/ */
public function exists(string $key): bool 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) 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 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 else
{ {
\apcu_store($key, $value, $expires); apcu_store($key, $value, $expires);
} }
return $this; return $this;
@ -114,7 +114,7 @@ class ApcuDriver extends AbstractDriver {
*/ */
public function delete(string $key): bool 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 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')) if (function_exists('apcu_clear_cache'))
{ {
return \apcu_clear_cache(); return apcu_clear_cache();
} }
if (function_exists('apc_clear_cache')) return TRUE;
{
return \apc_clear_cache();
}
} }
/** /**
@ -158,7 +155,7 @@ class ApcuDriver extends AbstractDriver {
if ($this->exists($key)) if ($this->exists($key))
{ {
$value = $this->get($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"); $this->getLogger()->warn("Tried to set expiration on a key that does not exist");