/**
  * @param $area
  * @dataProvider loadDataProvider
  */
 public function testLoad($area)
 {
     $configData = ['some' => 'config', 'data' => 'value'];
     $this->_cacheMock->expects($this->once())->method('load')->with($area . '::DiConfig')->will($this->returnValue(false));
     $this->_readerMock->expects($this->once())->method('read')->with($area)->will($this->returnValue($configData));
     $this->assertEquals($configData, $this->_model->load($area));
 }
 /**
  * Test for getAllOptions method
  *
  * @param $cachedDataSrl
  * @param $cachedDataUnsrl
  *
  * @dataProvider testGetAllOptionsDataProvider
  */
 public function testGetAllOptions($cachedDataSrl, $cachedDataUnsrl)
 {
     $this->storeMock->expects($this->once())->method('getCode')->will($this->returnValue('store_code'));
     $this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($this->storeMock));
     $this->cacheConfig->expects($this->once())->method('load')->with($this->equalTo('COUNTRYOFMANUFACTURE_SELECT_STORE_store_code'))->will($this->returnValue($cachedDataSrl));
     $countryOfManufacture = $this->objectManagerHelper->getObject('Magento\\Catalog\\Model\\Product\\Attribute\\Source\\Countryofmanufacture', ['storeManager' => $this->storeManagerMock, 'configCacheType' => $this->cacheConfig]);
     $this->assertEquals($cachedDataUnsrl, $countryOfManufacture->getAllOptions());
 }
Esempio n. 3
0
 public function testGetTotalUnserializeCachedCollectorCodes()
 {
     $total = $this->getMockForAbstractClass('Magento\\Sales\\Model\\Order\\Total\\AbstractTotal');
     $this->salesConfig->expects($this->any())->method('getGroupTotals')->will($this->returnValue(['some_code' => ['instance' => 'Magento\\Sales\\Model\\Order\\Total\\AbstractTotal', 'sort_order' => 1903], 'other_code' => ['instance' => 'Magento\\Sales\\Model\\Order\\Total\\AbstractTotal', 'sort_order' => 1723]]));
     $this->orderTotalFactory->expects($this->any())->method('create')->with('Magento\\Sales\\Model\\Order\\Total\\AbstractTotal')->will($this->returnValue($total));
     $this->configCacheType->expects($this->once())->method('load')->with('sorted_collectors')->will($this->returnValue('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}'));
     $this->configCacheType->expects($this->never())->method('save');
     $this->assertSame(['other_code' => $total, 'some_code' => $total], $this->object->getTotalModels());
 }