/**
  * @inheritDoc
  */
 public function save(DesignConfigInterface $designConfig)
 {
     if (!($designConfig->getExtensionAttributes() && $designConfig->getExtensionAttributes()->getDesignConfigData())) {
         throw new LocalizedException(__('Can not save empty config'));
     }
     $this->configStorage->save($designConfig);
     $this->reinitableConfig->reinit();
     $this->reindexGrid();
     return $designConfig;
 }
 public function testSave()
 {
     $scope = 'website';
     $scopeId = 1;
     $this->transactionFactoryMock->expects($this->exactly(2))->method('create')->willReturn($this->transactionMock);
     $this->designConfigMock->expects($this->once())->method('getExtensionAttributes')->willReturn($this->extensionAttributes);
     $this->extensionAttributes->expects($this->once())->method('getDesignConfigData')->willReturn([$this->designConfigData]);
     $this->designConfigData->expects($this->atLeastOnce())->method('getValue')->willReturn('value');
     $this->designConfigMock->expects($this->exactly(2))->method('getScope')->willReturn($scope);
     $this->designConfigMock->expects($this->exactly(2))->method('getScopeId')->willReturn($scopeId);
     $this->designConfigData->expects($this->exactly(2))->method('getFieldConfig')->willReturn(['path' => 'design/head/default_title']);
     $this->backendModelFactoryMock->expects($this->once())->method('create')->with(['value' => 'value', 'scope' => $scope, 'scopeId' => $scopeId, 'config' => ['path' => 'design/head/default_title']])->willReturn($this->backendModelMock);
     $this->valueCheckerMock->expects($this->once())->method('isDifferentFromDefault')->with('value', $scope, $scopeId, 'design/head/default_title')->willReturn(true);
     $this->transactionMock->expects($this->once())->method('addObject')->with($this->backendModelMock);
     $this->transactionMock->expects($this->once())->method('save');
     $this->transactionMock->expects($this->once())->method('delete');
     $this->model->save($this->designConfigMock);
 }