Open Journal Systems  3.3.0
CacheAdapterFactoryTest.php
1 <?php
2 
4 
7 use Doctrine\Common\Cache\ArrayCache;
8 use Zend\Cache\StorageFactory;
9 
14 {
16  private $cache;
17 
19  private $adapter;
20 
24  protected function setup()
25  {
26  parent::setUp();
27  $this->cache = new ArrayCache();
28  $this->adapter = new DoctrineCacheAdapter($this->cache);
29  }
30 
34  public function testEnsuresConfigIsObject()
35  {
37  }
38 
42  public function testEnsuresKnownType()
43  {
44  CacheAdapterFactory::fromCache(new \stdClass());
45  }
46 
47  public function cacheProvider()
48  {
49  return array(
50  array(new DoctrineCacheAdapter(new ArrayCache()), 'Guzzle\Cache\DoctrineCacheAdapter'),
51  array(new ArrayCache(), 'Guzzle\Cache\DoctrineCacheAdapter'),
52  array(StorageFactory::factory(array('adapter' => 'memory')), 'Guzzle\Cache\Zf2CacheAdapter'),
53  );
54  }
55 
59  public function testCreatesNullCacheAdapterByDefault($cache, $type)
60  {
61  $adapter = CacheAdapterFactory::fromCache($cache);
62  $this->assertInstanceOf($type, $adapter);
63  }
64 }
Guzzle\Tests\GuzzleTestCase
Definition: GuzzleTestCase.php:22
Guzzle\Tests\Cache
Definition: CacheAdapterFactoryTest.php:3
Guzzle\Cache\DoctrineCacheAdapter
Definition: DoctrineCacheAdapter.php:12
Guzzle\Tests\Cache\CacheAdapterFactoryTest
Definition: CacheAdapterFactoryTest.php:13
Guzzle\Cache\CacheAdapterFactory\fromCache
static fromCache($cache)
Definition: CacheAdapterFactory.php:25
Guzzle\Tests\Cache\CacheAdapterFactoryTest\cacheProvider
cacheProvider()
Definition: CacheAdapterFactoryTest.php:53
Guzzle\Cache\CacheAdapterFactory
Definition: CacheAdapterFactory.php:15
Guzzle\Tests\Cache\CacheAdapterFactoryTest\testEnsuresKnownType
testEnsuresKnownType()
Definition: CacheAdapterFactoryTest.php:48
Guzzle\Tests\Cache\CacheAdapterFactoryTest\testEnsuresConfigIsObject
testEnsuresConfigIsObject()
Definition: CacheAdapterFactoryTest.php:40
Guzzle\Tests\Cache\CacheAdapterFactoryTest\testCreatesNullCacheAdapterByDefault
testCreatesNullCacheAdapterByDefault($cache, $type)
Definition: CacheAdapterFactoryTest.php:65
Guzzle\Tests\Cache\CacheAdapterFactoryTest\setup
setup()
Definition: CacheAdapterFactoryTest.php:30