Mise à jour des librairies vendor

This commit is contained in:
Caribana
2018-05-01 14:43:32 +02:00
parent b67375ae8e
commit d776be73fc
5211 changed files with 59115 additions and 25863 deletions

View File

@@ -18,8 +18,9 @@
namespace Google\Auth\Tests;
use Google\Auth\CacheTrait;
use PHPUnit\Framework\TestCase;
class CacheTraitTest extends \PHPUnit_Framework_TestCase
class CacheTraitTest extends TestCase
{
private $mockFetcher;
private $mockCacheItem;
@@ -44,6 +45,10 @@ class CacheTraitTest extends \PHPUnit_Framework_TestCase
public function testSuccessfullyPullsFromCache()
{
$expectedValue = '1234';
$this->mockCacheItem
->expects($this->once())
->method('isHit')
->will($this->returnValue(true));
$this->mockCacheItem
->expects($this->once())
->method('get')
@@ -61,6 +66,64 @@ class CacheTraitTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($expectedValue, $cachedValue);
}
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')
->will($this->returnValue($expectedValue));
$this->mockCache
->expects($this->once())
->method('getItem')
->with($expectedKey)
->will($this->returnValue($this->mockCacheItem));
$implementation = new CacheTraitImplementation([
'cache' => $this->mockCache,
'key' => $key,
]);
$cachedValue = $implementation->gCachedValue();
$this->assertEquals($expectedValue, $cachedValue);
}
public function testSuccessfullyPullsFromCacheWithLongKey()
{
$key = 'this-key-is-over-64-characters-and-it-will-still-work'
. '-but-it-will-be-hashed-and-shortened';
$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')
->will($this->returnValue($expectedValue));
$this->mockCache
->expects($this->once())
->method('getItem')
->with($expectedKey)
->will($this->returnValue($this->mockCacheItem));
$implementation = new CacheTraitImplementation([
'cache' => $this->mockCache,
'key' => $key
]);
$cachedValue = $implementation->gCachedValue();
$this->assertEquals($expectedValue, $cachedValue);
}
public function testFailsPullFromCacheWithNoCache()
{
$implementation = new CacheTraitImplementation();