/**
  * Retrieve design config data with correct scope
  *
  * @param string $scope
  * @param string $scopeId
  * @return DesignConfigInterface
  */
 protected function getDesignConfigData($scope, $scopeId)
 {
     /** @var DesignConfigInterface $designConfigData */
     $designConfigData = $this->designConfigFactory->create();
     $scopeInfo = $this->getCorrectScope($scope, $scopeId);
     $designConfigData->setScope($scopeInfo['scope']);
     $designConfigData->setScopeId($scopeInfo['scopeId']);
     return $designConfigData;
 }
 public function testCreateInSingleStoreMode()
 {
     $scope = 'default';
     $scopeId = 0;
     $data = ['header_default_title' => 'value'];
     $metadata = ['header_default_title' => ['path' => 'design/header/default_title', 'fieldset' => 'head'], 'head_default_description' => ['path' => 'design/head/default_description', 'fieldset' => 'head']];
     $this->scopeValidator->expects($this->once())->method('isValidScope')->with($scope, $scopeId)->willReturn(true);
     $this->storeManager->expects($this->once())->method('isSingleStoreMode')->willReturn(true);
     $this->storeManager->expects($this->once())->method('getWebsites')->willReturn([$this->website]);
     $this->website->expects($this->once())->method('getId')->willReturn(1);
     $this->designConfigFactory->expects($this->once())->method('create')->willReturn($this->designConfig);
     $this->designConfig->expects($this->once())->method('setScope')->willReturn('websites');
     $this->designConfig->expects($this->once())->method('setScopeId')->willReturn(1);
     $this->metadataProvider->expects($this->once())->method('get')->willReturn($metadata);
     $this->designConfigDataFactory->expects($this->exactly(2))->method('create')->willReturn($this->designConfigData);
     $this->designConfigData->expects($this->exactly(2))->method('setPath')->withConsecutive(['design/header/default_title'], ['design/head/default_description']);
     $this->designConfigData->expects($this->exactly(2))->method('setFieldConfig')->withConsecutive([['path' => 'design/header/default_title', 'fieldset' => 'head', 'field' => 'header_default_title']], [['path' => 'design/head/default_description', 'fieldset' => 'head', 'field' => 'head_default_description']]);
     $this->designConfigData->expects($this->once())->method('setValue')->with('value');
     $this->configExtensionFactory->expects($this->once())->method('create')->willReturn($this->designConfigExtension);
     $this->designConfigExtension->expects($this->once())->method('setDesignConfigData')->with([$this->designConfigData, $this->designConfigData]);
     $this->designConfig->expects($this->once())->method('setExtensionAttributes')->with($this->designConfigExtension);
     $this->assertSame($this->designConfig, $this->factory->create($scope, $scopeId, $data));
 }