Skip to content
Snippets Groups Projects
Commit 790a6c32 authored by David Maus's avatar David Maus Committed by Demian Katz
Browse files

Also test fromString cached and non-cached

parent dc92f603
No related merge requests found
...@@ -48,20 +48,24 @@ class CacheDecoratorTest extends \PHPUnit_Framework_TestCase ...@@ -48,20 +48,24 @@ class CacheDecoratorTest extends \PHPUnit_Framework_TestCase
* *
* @return void * @return void
*/ */
public function testFromFile () public function testFromFileAndString ()
{ {
$cache = $this->getMockForAbstractClass('Zend\Cache\Storage\StorageInterface', array('setItem', 'hasItem')); $cache = $this->getMockForAbstractClass('Zend\Cache\Storage\StorageInterface', array('setItem', 'hasItem'));
$cache->expects($this->once()) $cache->expects($this->exactly(2))
->method('setItem'); ->method('setItem');
$cache->expects($this->once()) $cache->expects($this->exactly(2))
->method('hasItem') ->method('hasItem')
->will($this->returnValue(false)); ->will($this->returnValue(false));
$reader = $this->getMockForAbstractClass('Zend\Config\Reader\ReaderInterface', array('fromFile')); $reader = $this->getMockForAbstractClass('Zend\Config\Reader\ReaderInterface', array('fromFile', 'fromString'));
$reader->expects($this->once()) $reader->expects($this->once())
->method('fromFile') ->method('fromFile')
->will($this->returnValue(array())); ->will($this->returnValue(array()));
$reader->expects($this->once())
->method('fromString')
->will($this->returnValue(array()));
$deco = new CacheDecorator($reader, $cache); $deco = new CacheDecorator($reader, $cache);
$deco->fromFile('ignore'); $deco->fromFile('ignore');
$deco->fromString('ignore');
} }
/** /**
...@@ -69,19 +73,20 @@ class CacheDecoratorTest extends \PHPUnit_Framework_TestCase ...@@ -69,19 +73,20 @@ class CacheDecoratorTest extends \PHPUnit_Framework_TestCase
* *
* @return void * @return void
*/ */
public function testFromFileCached () public function testFromFileAndStringCached ()
{ {
$cache = $this->getMockForAbstractClass('Zend\Cache\Storage\StorageInterface', array('setItem', 'hasItem', 'getItem')); $cache = $this->getMockForAbstractClass('Zend\Cache\Storage\StorageInterface', array('setItem', 'hasItem', 'getItem'));
$cache->expects($this->never()) $cache->expects($this->never())
->method('setItem'); ->method('setItem');
$cache->expects($this->once()) $cache->expects($this->exactly(2))
->method('hasItem') ->method('hasItem')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$cache->expects($this->once()) $cache->expects($this->exactly(2))
->method('getItem') ->method('getItem')
->will($this->returnValue(array())); ->will($this->returnValue(array()));
$reader = $this->getMockForAbstractClass('Zend\Config\Reader\ReaderInterface', array('fromFile')); $reader = $this->getMockForAbstractClass('Zend\Config\Reader\ReaderInterface', array('fromFile', 'fromString'));
$deco = new CacheDecorator($reader, $cache); $deco = new CacheDecorator($reader, $cache);
$deco->fromFile('ignore'); $deco->fromFile('ignore');
$deco->fromString('ignore');
} }
} }
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment