/**
  * @param string $name
  * @param string $primaryFieldName
  * @param string $requestFieldName
  * @param DataProvider\DataLoader $dataLoader
  * @param DataProvider\MetadataLoader $metadataLoader
  * @param CollectionFactory $configCollectionFactory
  * @param array $meta
  * @param array $data
  */
 public function __construct($name, $primaryFieldName, $requestFieldName, DataProvider\DataLoader $dataLoader, DataProvider\MetadataLoader $metadataLoader, CollectionFactory $configCollectionFactory, array $meta = [], array $data = [])
 {
     parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
     $this->dataLoader = $dataLoader;
     $this->metadataLoader = $metadataLoader;
     $this->collection = $configCollectionFactory->create();
     $this->meta = array_merge($this->meta, $this->metadataLoader->getData());
 }
 protected function setUp()
 {
     $this->dataLoader = $this->getMockBuilder('Magento\\Theme\\Model\\Design\\Config\\DataProvider\\DataLoader')->disableOriginalConstructor()->getMock();
     $this->metadataLoader = $this->getMockBuilder('Magento\\Theme\\Model\\Design\\Config\\DataProvider\\MetadataLoader')->disableOriginalConstructor()->getMock();
     $this->metadataLoader->expects($this->once())->method('getData')->willReturn([]);
     $this->collection = $this->getMockBuilder('Magento\\Theme\\Model\\ResourceModel\\Design\\Config\\Collection')->disableOriginalConstructor()->getMock();
     $collectionFactory = $this->getMockBuilder('Magento\\Theme\\Model\\ResourceModel\\Design\\Config\\CollectionFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $collectionFactory->expects($this->once())->method('create')->willReturn($this->collection);
     $this->model = new DataProvider('scope', 'scope', 'scope', $this->dataLoader, $this->metadataLoader, $collectionFactory);
 }
 /**
  * @param string $scope
  * @param string $scopeId
  * @param string $showFallbackReset
  * @dataProvider dataProviderGetData
  */
 public function testGetData($scope, $scopeId, $showFallbackReset)
 {
     $this->request->expects($this->exactly(2))->method('getParam')->willReturnMap([['scope', null, $scope], ['scope_id', null, $scopeId]]);
     $this->scopeFallbackResolver->expects($this->atLeastOnce())->method('getFallbackScope')->with($scope, $scopeId)->willReturn([$scope, $scopeId]);
     $this->storeManager->expects($this->once())->method('isSingleStoreMode')->willReturn(false);
     $this->designConfigRepository->expects($this->once())->method('getByScope')->with($scope, $scopeId)->willReturn($this->designConfig);
     $this->designConfig->expects($this->once())->method('getExtensionAttributes')->willReturn($this->designConfigExtension);
     $this->designConfigExtension->expects($this->once())->method('getDesignConfigData')->willReturn([$this->designConfigData]);
     $this->designConfigData->expects($this->atLeastOnce())->method('getFieldConfig')->willReturn(['field' => 'field', 'fieldset' => 'fieldset1']);
     $this->designConfigData->expects($this->once())->method('getValue')->willReturn('value');
     $result = $this->model->getData();
     $expected = ['fieldset1' => ['children' => ['field' => ['arguments' => ['data' => ['config' => ['default' => 'value', 'showFallbackReset' => $showFallbackReset]]]]]]];
     $this->assertEquals($expected, $result);
 }