-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathDoctrineCacheAdapterTest.php
42 lines (36 loc) · 1.19 KB
/
DoctrineCacheAdapterTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
namespace Aws\Test;
use Aws\CacheInterface;
use Aws\DoctrineCacheAdapter;
use Doctrine\Common\Cache\Cache;
use PHPUnit\Framework\TestCase;
class DoctrineCacheAdapterTest extends TestCase
{
public function testProxiesCallsToDoctrine()
{
$wrappedCache = $this->getMockBuilder(Cache::class)->getMock();
$wrappedCache->expects($this->once())
->method('fetch')
->with('foo')
->willReturn('bar');
$wrappedCache->expects($this->once())
->method('save')
->with('foo', 'bar', 0)
->willReturn(true);
$wrappedCache->expects($this->once())
->method('delete')
->with('foo')
->willReturn(true);
$cache = new DoctrineCacheAdapter($wrappedCache);
$cache->set('foo', 'bar', 0);
$cache->get('foo');
$cache->remove('foo');
}
public function testAdaptsCacheToAwsAndDoctrine()
{
$wrappedCache = $this->getMockBuilder(Cache::class)->getMock();
$cache = new DoctrineCacheAdapter($wrappedCache);
$this->assertInstanceOf(Cache::class, $cache);
$this->assertInstanceOf(CacheInterface::class, $cache);
}
}