From b52b49ab25f53ddcc1a84b63bb308fd875887d5c Mon Sep 17 00:00:00 2001 From: MaartenGDev Date: Sat, 1 Oct 2016 21:16:22 +0200 Subject: [PATCH] Changed Class name to File name --- src/Cache.php | 6 +++--- src/Exceptions/CacheEntryNotFoundException.php | 2 +- tests/CacheTest.php | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Cache.php b/src/Cache.php index 18353bb..5a7573b 100644 --- a/src/Cache.php +++ b/src/Cache.php @@ -3,7 +3,7 @@ use MaartenGDev\Exceptions\BadMethodCallException; -use MaartenGDev\Exceptions\CacheEntryNotFound; +use MaartenGDev\Exceptions\CacheEntryNotFoundException; use MaartenGDev\Exceptions\CacheFileNotFoundException; class Cache implements CacheInterface @@ -70,7 +70,7 @@ public function has($key, $callable = null, $expire = null) * @param $key * @param null $expire * @return mixed - * @throws CacheEntryNotFound + * @throws CacheEntryNotFoundException */ public function get($key, $expire = null) { @@ -79,7 +79,7 @@ public function get($key, $expire = null) $expireTime = $hasProvidedExpireTime ? $expire : $this->expire; if (!$this->isValid($key, $expireTime)) { - throw new CacheEntryNotFound('No cache entry found.'); + throw new CacheEntryNotFoundException('No cache entry found.'); } return $this->storage->get($key); diff --git a/src/Exceptions/CacheEntryNotFoundException.php b/src/Exceptions/CacheEntryNotFoundException.php index 10d6750..db88694 100644 --- a/src/Exceptions/CacheEntryNotFoundException.php +++ b/src/Exceptions/CacheEntryNotFoundException.php @@ -4,7 +4,7 @@ use Exception; -class CacheEntryNotFound extends Exception +class CacheEntryNotFoundException extends Exception { } \ No newline at end of file diff --git a/tests/CacheTest.php b/tests/CacheTest.php index ba47608..b8eb1eb 100644 --- a/tests/CacheTest.php +++ b/tests/CacheTest.php @@ -4,9 +4,10 @@ use MaartenGDev\Cache; use MaartenGDev\Exceptions\BadMethodCallException; -use MaartenGDev\Exceptions\CacheEntryNotFound; +use MaartenGDev\Exceptions\CacheEntryNotFoundException; use MaartenGDev\Exceptions\CacheFileNotFoundException; use MaartenGDev\LocalDriver; +use PHPUnit_Framework_Error_Warning; use PHPUnit_Framework_TestCase; class CacheTest extends PHPUnit_Framework_TestCase @@ -81,14 +82,14 @@ public function testGetCacheItemThatDoesExist(){ public function testCacheItemHasFileButCacheItemHasExpired(){ $store = $this->cache->store('cache_with_file_but_invalid','With file but expired'); - $this->expectException(CacheEntryNotFound::class); + $this->expectException(CacheEntryNotFoundException::class); $cacheItem = $this->cache->get('cache_with_file_but_invalid', -2); } public function testStoreCacheItemInInvalidDirectory(){ - $this->expectException(\PHPUnit_Framework_Error_Warning::class); + $this->expectException(PHPUnit_Framework_Error_Warning::class); $dir = dirname(__FILE__) . '/../invalid_directory/'; $localStorage = new LocalDriver($dir);