/**
  * @inheritDoc
  */
 public function delete(DesignConfigInterface $designConfig)
 {
     if (!($designConfig->getExtensionAttributes() && $designConfig->getExtensionAttributes()->getDesignConfigData())) {
         throw new LocalizedException(__('Can not save empty config'));
     }
     $this->configStorage->delete($designConfig);
     $this->reinitableConfig->reinit();
     $this->reindexGrid();
     return $designConfig;
 }
 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 testDelete()
 {
     $scope = 'website';
     $scopeId = 1;
     $backendModel = $this->getMockBuilder('Magento\\Framework\\App\\Config\\Value')->disableOriginalConstructor()->getMock();
     $this->designConfig->expects($this->once())->method('getExtensionAttributes')->willReturn($this->designConfigExtension);
     $this->designConfigExtension->expects($this->once())->method('getDesignConfigData')->willReturn([$this->designConfigData]);
     $this->transactionFactoryMock->expects($this->once())->method('create')->willReturn($this->transactionMock);
     $this->designConfigData->expects($this->once())->method('getValue')->willReturn('value');
     $this->designConfigData->expects($this->once())->method('getFieldConfig')->willReturn([]);
     $this->designConfig->expects($this->once())->method('getScope')->willReturn($scope);
     $this->designConfig->expects($this->once())->method('getScopeId')->willReturn($scopeId);
     $this->backendModelFactoryMock->expects($this->once())->method('create')->with(['value' => 'value', 'scope' => $scope, 'scopeId' => $scopeId, 'config' => []])->willReturn($backendModel);
     $this->transactionMock->expects($this->once())->method('addObject')->with($backendModel);
     $this->transactionMock->expects($this->once())->method('delete');
     $this->model->delete($this->designConfig);
 }