public function testDelete() { $this->designConfig->expects($this->exactly(2))->method('getExtensionAttributes')->willReturn($this->designExtension); $this->designExtension->expects($this->once())->method('getDesignConfigData')->willReturn([$this->designConfigData]); $this->configStorage->expects($this->once())->method('delete')->with($this->designConfig); $this->reinitableConfig->expects($this->once())->method('reinit'); $this->indexerRegistry->expects($this->once())->method('get')->with(Config::DESIGN_CONFIG_GRID_INDEXER_ID)->willReturn($this->indexer); $this->indexer->expects($this->once())->method('reindexAll'); $this->assertSame($this->designConfig, $this->repository->delete($this->designConfig)); }
public function testSetCurrencySymbolData() { $websiteId = 1; $groupId = 2; $currencies = 'USD,EUR'; $symbols = []; $value['options']['fields']['customsymbol']['inherit'] = 1; $this->prepareMocksForGetCurrencySymbolsData($websiteId, $groupId, $currencies); /** * @var \Magento\Config\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ $configMock = $this->getMock('Magento\\Config\\Model\\Config', ['setSection', 'setWebsite', 'setStore', 'setGroups', 'save'], [], '', false); $this->configFactoryMock->expects($this->any())->method('create')->willReturn($configMock); $configMock->expects($this->any())->method('setSection')->with(Currencysymbol::CONFIG_SECTION)->willReturnSelf(); $configMock->expects($this->any())->method('setWebsite')->with(null)->willReturnSelf(); $configMock->expects($this->any())->method('setStore')->with(null)->willReturnSelf(); $configMock->expects($this->any())->method('setGroups')->with($value)->willReturnSelf(); $this->coreConfigMock->expects($this->once())->method('reinit'); $this->cacheTypeListMock->expects($this->atLeastOnce())->method('invalidate'); $this->eventManagerMock->expects($this->atLeastOnce())->method('dispatch')->willReturnMap([['admin_system_config_changed_section_currency_before_reinit', null, null], ['admin_system_config_changed_section_currency', null, null]]); $this->assertInstanceOf('Magento\\CurrencySymbol\\Model\\System\\Currencysymbol', $this->model->setCurrencySymbolsData($symbols)); }