예제 #1
0
 /**
  * @param string|null $fixtureFrontendId
  * @param string $inputCacheType
  * @param string $expectedFrontendId
  *
  * @dataProvider getDataProvider
  */
 public function testGet($fixtureFrontendId, $inputCacheType, $expectedFrontendId)
 {
     $this->_arguments->expects($this->once())->method('getCacheTypeFrontendId')->with($inputCacheType)->will($this->returnValue($fixtureFrontendId));
     $cacheFrontend = $this->getMock('Magento\\Framework\\Cache\\FrontendInterface');
     $this->_cachePool->expects($this->once())->method('get')->with($expectedFrontendId)->will($this->returnValue($cacheFrontend));
     $accessProxy = $this->getMock('Magento\\Framework\\App\\Cache\\Type\\AccessProxy', array(), array(), '', false);
     $this->_objectManager->expects($this->once())->method('create')->with('Magento\\Framework\\App\\Cache\\Type\\AccessProxy', $this->identicalTo(array('frontend' => $cacheFrontend, 'identifier' => $inputCacheType)))->will($this->returnValue($accessProxy));
     $this->assertSame($accessProxy, $this->_model->get($inputCacheType));
     // Result has to be cached in memory
     $this->assertSame($accessProxy, $this->_model->get($inputCacheType));
 }
예제 #2
0
 public function testCreate()
 {
     $config = ['active' => 1, 'adapter' => 'Magento\\Framework\\App\\Resource\\ConnectionAdapterInterface'];
     $this->localConfig->expects($this->once())->method('getConnection')->with('connection_name')->will($this->returnValue($config));
     $adapterMock = $this->getMock('Magento\\Framework\\App\\Resource\\ConnectionAdapterInterface');
     $this->objectManager->expects($this->once())->method('create')->with('Magento\\Framework\\App\\Resource\\ConnectionAdapterInterface', $config)->will($this->returnValue($adapterMock));
     $connectionMock = $this->getMock('Magento\\Framework\\DB\\Adapter\\AdapterInterface');
     $adapterMock->expects($this->once())->method('getConnection')->will($this->returnValue($connectionMock));
     $this->assertEquals($connectionMock, $this->model->create('connection_name'));
 }
예제 #3
0
 protected function setUp()
 {
     $this->configMock = $this->getMock('Magento\\Framework\\App\\Arguments', array(), array(), '', false);
     $this->configMock->expects($this->any())->method('getResources')->will($this->returnValue(array('default_setup' => array('default_setup'), 'custom_resource' => array('custom_resource'))));
     $this->mediaDatabase = new \Magento\Backend\Model\Config\Source\Storage\Media\Database($this->configMock);
 }