public function testCreate()
 {
     $scope = 'website';
     $scopeId = 1;
     $data = ['scope' => $scope, 'scopeId' => $scopeId, 'value' => 'value', 'config' => ['path' => 'design/head/default_title', 'backend_model' => 'Magento\\Framework\\App\\Config\\Value']];
     $this->metadataProviderMock->expects($this->once())->method('get')->willReturn(['head_default_title' => ['path' => 'design/head/default_title']]);
     $this->collectionFactoryMock->expects($this->once())->method('create')->willReturn($this->collection);
     $this->collection->expects($this->once())->method('addPathsFilter')->with(['head_default_title' => 'design/head/default_title']);
     $this->collection->expects($this->once())->method('addFieldToFilter')->with('scope', $scope);
     $this->collection->expects($this->once())->method('addScopeIdFilter')->with($scopeId);
     $this->collection->expects($this->once())->method('getData')->willReturn([['config_id' => 1, 'path' => 'design/head/default_title']]);
     $this->objectManagerMock->expects($this->once())->method('create')->with('Magento\\Framework\\App\\Config\\Value', ['data' => ['path' => 'design/head/default_title', 'scope' => $scope, 'scope_id' => $scopeId, 'field_config' => $data['config'], 'config_id' => 1]])->willReturn($this->backendModel);
     $this->backendModel->expects($this->once())->method('setValue')->willReturn('value');
     $this->assertSame($this->backendModel, $this->model->create($data));
 }
 /**
  * Delete design configuration from storage
  *
  * @param DesignConfigInterface $designConfig
  * @return void
  */
 public function delete(DesignConfigInterface $designConfig)
 {
     $fieldsData = $designConfig->getExtensionAttributes()->getDesignConfigData();
     /* @var $deleteTransaction \Magento\Framework\DB\Transaction */
     $deleteTransaction = $this->transactionFactory->create();
     foreach ($fieldsData as $fieldData) {
         /** @var ValueInterface|Value $backendModel */
         $backendModel = $this->backendModelFactory->create(['value' => $fieldData->getValue(), 'scope' => $designConfig->getScope(), 'scopeId' => $designConfig->getScopeId(), 'config' => $fieldData->getFieldConfig()]);
         if (!$backendModel->isObjectNew()) {
             $deleteTransaction->addObject($backendModel);
         }
     }
     $deleteTransaction->delete();
 }