Skip to content

Commit

Permalink
Changed Class name to File name
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartenGDev committed Oct 1, 2016
1 parent 735abcc commit b52b49a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


use MaartenGDev\Exceptions\BadMethodCallException;
use MaartenGDev\Exceptions\CacheEntryNotFound;
use MaartenGDev\Exceptions\CacheEntryNotFoundException;
use MaartenGDev\Exceptions\CacheFileNotFoundException;

class Cache implements CacheInterface
Expand Down Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/CacheEntryNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Exception;

class CacheEntryNotFound extends Exception
class CacheEntryNotFoundException extends Exception
{

}
7 changes: 4 additions & 3 deletions tests/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b52b49a

Please sign in to comment.