public function testGetCacheAdapterFromServiceLocator() { $options = new CacheOptions(); $options->setEnabled(true); $options->setAdapter(['stuff1' => 'Cache\\MemoryAdapter', 'stuff2' => 'Cache\\FilesystemAdapter']); $cacheManger = new CacheManager($options); $serviceLocator = $this->getMock('Zend\\ServiceManager\\ServiceLocatorInterface'); $map = [['Cache\\MemoryAdapter', new \Zend\Cache\Storage\Adapter\Memory()], ['Cache\\FilesystemAdapter', new \Zend\Cache\Storage\Adapter\Filesystem()]]; $serviceLocator->expects($this->any())->method('has')->will($this->returnValue(true)); $serviceLocator->expects($this->any())->method('get')->will($this->returnValueMap($map)); $cacheManger->setServiceLocator($serviceLocator); $this->assertInstanceOf('Zend\\Cache\\Storage\\Adapter\\Memory', $cacheManger->getCacheAdapter('stuff1')); $this->assertInstanceOf('Zend\\Cache\\Storage\\Adapter\\Filesystem', $cacheManger->getCacheAdapter('stuff2')); $this->assertNull($cacheManger->getCacheAdapter('stuff3')); }