/
DoctrineParserCacheTest.php
38 lines (28 loc) · 1.12 KB
/
DoctrineParserCacheTest.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
<?php
namespace Symfony\Bridge\Doctrine\Tests\ExpressionLanguage;
use Symfony\Bridge\Doctrine\ExpressionLanguage\DoctrineParserCache;
class DoctrineParserCacheTest extends \PHPUnit_Framework_TestCase
{
public function testFetch()
{
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
$parserCache = new DoctrineParserCache($doctrineCacheMock);
$doctrineCacheMock->expects($this->once())
->method('fetch')
->will($this->returnValue('bar'));
$result = $parserCache->fetch('foo');
$this->assertEquals('bar', $result);
}
public function testSave()
{
$doctrineCacheMock = $this->getMock('Doctrine\Common\Cache\Cache');
$parserCache = new DoctrineParserCache($doctrineCacheMock);
$expression = $this->getMockBuilder('Symfony\Component\ExpressionLanguage\ParsedExpression')
->disableOriginalConstructor()
->getMock();
$doctrineCacheMock->expects($this->once())
->method('save')
->with('foo', $expression);
$parserCache->save('foo', $expression);
}
}