diff --git a/.travis.yml b/.travis.yml index b9e083e..a85226d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ cache: - vendor php: - - 5.5 - 5.6 - 7.0 diff --git a/Tests/Persistence/TokenPersistenceTest.php b/Tests/Persistence/TokenPersistenceTest.php index c391565..ff208e3 100644 --- a/Tests/Persistence/TokenPersistenceTest.php +++ b/Tests/Persistence/TokenPersistenceTest.php @@ -5,7 +5,8 @@ use Eljam\GuzzleJwt\JwtToken; use Eljam\GuzzleJwt\Persistence\NullTokenPersistence; use Eljam\GuzzleJwt\Persistence\SimpleCacheTokenPersistence; -use Symfony\Component\Cache\Simple\FilesystemCache; +use Kodus\Cache\MockCache; +use Psr\SimpleCache\CacheInterface; /** * @author Nicolas Reynis (nreynis) @@ -26,12 +27,28 @@ public function testNullTokenPersistence() $this->assertNull($tokenPersistence->restoreToken()); } + /** + * testSimpleCacheTokenPersistenceInterface. + * Makes sure we only use the interface methods. + */ + public function testSimpleCacheTokenPersistenceInterface() + { + $simpleCache = $this->getMock(CacheInterface::class); + $tokenPersistence = new SimpleCacheTokenPersistence($simpleCache); + $token = new JwtToken('foo', new \DateTime('now')); + + $this->assertNull($tokenPersistence->saveToken($token)); + $this->assertNull($tokenPersistence->hasToken()); + $this->assertNull($tokenPersistence->restoreToken()); + $this->assertNull($tokenPersistence->deleteToken()); + } + /** * testSimpleCacheTokenPersistence. */ public function testSimpleCacheTokenPersistence() { - $simpleCache = new FilesystemCache(); + $simpleCache = new MockCache(); $tokenPersistence = new SimpleCacheTokenPersistence($simpleCache); $token = new JwtToken('foo', new \DateTime('now')); diff --git a/composer.json b/composer.json index 729f68a..18d7131 100644 --- a/composer.json +++ b/composer.json @@ -18,10 +18,10 @@ "require-dev": { "phpunit/phpunit": "4.5", "satooshi/php-coveralls": "^0.6.1", - "symfony/cache": ">=3.3" + "kodus/mock-cache": "^1.0" }, "require": { - "php" : ">=5.5.0", + "php" : ">=5.6.0", "guzzlehttp/guzzle": "~6.0", "psr/simple-cache": "^1.0", "symfony/options-resolver": ">=2.8" diff --git a/src/Persistence/SimpleCacheTokenPersistence.php b/src/Persistence/SimpleCacheTokenPersistence.php index 7179d9d..7847e2d 100644 --- a/src/Persistence/SimpleCacheTokenPersistence.php +++ b/src/Persistence/SimpleCacheTokenPersistence.php @@ -61,7 +61,7 @@ public function restoreToken() */ public function deleteToken() { - $this->cache->deleteItem($this->cacheKey); + $this->cache->delete($this->cacheKey); return; }