123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace Doctrine\Tests\Common\Cache;
- class CacheProviderTest extends \Doctrine\Tests\DoctrineTestCase
- {
- public function testFetchMultiWillFilterNonRequestedKeys()
- {
-
- $cache = $this->getMockForAbstractClass(
- 'Doctrine\Common\Cache\CacheProvider',
- array(),
- '',
- true,
- true,
- true,
- array('doFetchMultiple')
- );
- $cache
- ->expects($this->once())
- ->method('doFetchMultiple')
- ->will($this->returnValue(array(
- '[foo][1]' => 'bar',
- '[bar][1]' => 'baz',
- '[baz][1]' => 'tab',
- )));
- $this->assertEquals(
- array('foo' => 'bar', 'bar' => 'baz'),
- $cache->fetchMultiple(array('foo', 'bar'))
- );
- }
- public function testFailedDeleteAllDoesNotChangeNamespaceVersion()
- {
-
- $cache = $this->getMockForAbstractClass(
- 'Doctrine\Common\Cache\CacheProvider',
- array(),
- '',
- true,
- true,
- true,
- array('doFetch', 'doSave', 'doContains')
- );
- $cache
- ->expects($this->once())
- ->method('doFetch')
- ->with('DoctrineNamespaceCacheKey[]')
- ->will($this->returnValue(false));
-
- $cache
- ->expects($this->once())
- ->method('doSave')
- ->with('DoctrineNamespaceCacheKey[]')
- ->will($this->returnValue(false));
-
-
- $cache
- ->expects($this->once())
- ->method('doContains')
- ->with('[key][1]')
- ->will($this->returnValue(true));
- $this->assertFalse($cache->deleteAll(), 'deleteAll() returns false when saving the namespace version fails');
- $cache->contains('key');
- }
- }
|