Skip to content

Commit

Permalink
Prepare for v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Jun 13, 2017
2 parents 2b11246 + cc1ec6b commit db77bd2
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ php:
- 5.5
- 5.6
- 7.0
- hhvm
- 7.1

env:
- COMPOSER_CMD="composer install"
Expand All @@ -21,7 +21,7 @@ matrix:
env: RUN_CS_FIXER=true COMPOSER_CMD="composer install"

before_script:
- $(echo $COMPOSER_CMD)
- $COMPOSER_CMD

script:
- if [ "${RUN_CS_FIXER}" = "true" ]; then
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
## 1.0.0 (12/06/2017)

### Changes

* Adds hashing and shortening to enforce max key length ([@bshaffer])
* Fix for better PSR-6 compliance - verifies a hit before getting the cache item ([@bshaffer])
* README fixes ([@bshaffer])
* Change authorization header key to lowercase ([@stanley-cheung])

## 0.4.0 (23/04/2015)

### Changes

* Export callback function to update auth metadata ([@stanley-cheung][])
* Adds an implementation of User Refresh Token auth ([@stanley-cheung][])

[@bshaffer]: https://github.com/bshaffer
[@stanley-cheung]: https://github.com/stanley-cheung
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"require": {
"php": ">=5.4",
"firebase/php-jwt": "~2.0|~3.0|~4.0",
"guzzlehttp/guzzle": "~5.3|~6.0",
"guzzlehttp/guzzle": "~5.3.1|~6.0",
"guzzlehttp/psr7": "~1.2",
"psr/http-message": "^1.0",
"psr/cache": "^1.0"
Expand Down
12 changes: 12 additions & 0 deletions tests/CacheTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public function setUp()
public function testSuccessfullyPullsFromCache()
{
$expectedValue = '1234';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand All @@ -66,6 +70,10 @@ public function testSuccessfullyPullsFromCacheWithInvalidKey()
$key = 'this-key-has-@-illegal-characters';
$expectedKey = 'thiskeyhasillegalcharacters';
$expectedValue = '1234';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand All @@ -92,6 +100,10 @@ public function testSuccessfullyPullsFromCacheWithLongKey()
$expectedKey = str_replace('-', '', $key);
$expectedKey = substr(hash('sha256', $expectedKey), 0, 64);
$expectedValue = '1234';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down
8 changes: 8 additions & 0 deletions tests/FetchAuthTokenCacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ public function testUsesCachedAuthToken()
{
$cacheKey = 'myKey';
$cachedValue = '2/abcdef1234567890';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -73,6 +77,10 @@ public function testGetsCachedAuthTokenUsingCachePrefix()
$prefix = 'test_prefix_';
$cacheKey = 'myKey';
$cachedValue = '2/abcdef1234567890';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down
8 changes: 8 additions & 0 deletions tests/Middleware/AuthTokenMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ public function testUsesCachedAuthToken()
{
$cacheKey = 'myKey';
$cachedValue = '2/abcdef1234567890';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -151,6 +155,10 @@ public function testGetsCachedAuthTokenUsingCacheOptions()
$prefix = 'test_prefix_';
$cacheKey = 'myKey';
$cachedValue = '2/abcdef1234567890';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down
12 changes: 10 additions & 2 deletions tests/Middleware/ScopedAccessTokenMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ public function testUsesCachedAuthToken()
$fakeAuthFunc = function ($unused_scopes) {
return '';
};
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -118,6 +122,10 @@ public function testGetsCachedAuthTokenUsingCachePrefix()
$fakeAuthFunc = function ($unused_scopes) {
return '';
};
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -153,7 +161,7 @@ public function testShouldSaveValueInCache()
};
$this->mockCacheItem
->expects($this->once())
->method('get')
->method('isHit')
->will($this->returnValue(false));
$this->mockCacheItem
->expects($this->once())
Expand Down Expand Up @@ -193,7 +201,7 @@ public function testShouldSaveValueInCacheWithCacheOptions()
};
$this->mockCacheItem
->expects($this->once())
->method('get')
->method('isHit')
->will($this->returnValue(false));
$this->mockCacheItem
->expects($this->once())
Expand Down
8 changes: 8 additions & 0 deletions tests/Subscriber/AuthTokenSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public function testUsesCachedAuthToken()
{
$cacheKey = 'myKey';
$cachedValue = '2/abcdef1234567890';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -143,6 +147,10 @@ public function testGetsCachedAuthTokenUsingCachePrefix()
$prefix = 'test_prefix_';
$cacheKey = 'myKey';
$cachedValue = '2/abcdef1234567890';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down
12 changes: 10 additions & 2 deletions tests/Subscriber/ScopedAccessTokenSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ public function testUsesCachedAuthToken()
$fakeAuthFunc = function ($unused_scopes) {
return '';
};
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -123,6 +127,10 @@ public function testGetsCachedAuthTokenUsingCachePrefix()
$fakeAuthFunc = function ($unused_scopes) {
return '';
};
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -156,7 +164,7 @@ public function testShouldSaveValueInCache()
};
$this->mockCacheItem
->expects($this->once())
->method('get')
->method('isHit')
->will($this->returnValue(false));
$this->mockCacheItem
->expects($this->once())
Expand Down Expand Up @@ -191,7 +199,7 @@ public function testShouldSaveValueInCacheWithCacheOptions()
};
$this->mockCacheItem
->expects($this->once())
->method('get')
->method('isHit')
->will($this->returnValue(false));
$this->mockCacheItem
->expects($this->once())
Expand Down

0 comments on commit db77bd2

Please sign in to comment.