public function testNext() { $this->assertEquals(Pool::DEFAULT_FRONTEND_ID, $this->_model->key()); $this->_model->next(); $this->assertEquals('resource1', $this->_model->key()); $this->assertSame($this->_frontendInstances['resource1'], $this->_model->current()); $this->_model->next(); $this->assertEquals('resource2', $this->_model->key()); $this->assertSame($this->_frontendInstances['resource2'], $this->_model->current()); $this->_model->next(); $this->assertNull($this->_model->key()); $this->assertFalse($this->_model->current()); }
/** * @param array $fixtureCacheConfig * @param array $frontendSettings * @param array $expectedFactoryArg * * @dataProvider initializationParamsDataProvider */ public function testInitializationParams(array $fixtureCacheConfig, array $frontendSettings, array $expectedFactoryArg) { $deploymentConfig = $this->getMock('Magento\\Framework\\App\\DeploymentConfig', [], [], '', false); $deploymentConfig->expects($this->once())->method('getConfigData')->with(FrontendPool::KEY_CACHE)->will($this->returnValue($fixtureCacheConfig)); $frontendFactory = $this->getMock('Magento\\Framework\\App\\Cache\\Frontend\\Factory', [], [], '', false); $frontendFactory->expects($this->at(0))->method('create')->with($expectedFactoryArg); $model = new \Magento\Framework\App\Cache\Frontend\Pool($deploymentConfig, $frontendFactory, $frontendSettings); $model->current(); }