public function testIsDifferentFromDefaultWithArrays()
 {
     $path = 'design/head/default_title';
     $this->fallbackResolver->expects($this->once())->method('getFallbackScope')->with('website', 1)->willReturn(['default', 0]);
     $this->appConfig->expects($this->once())->method('getValue')->with($path, 'default', 0)->willReturn([['qwe' => 123]]);
     $this->valueProcessor->expects($this->atLeastOnce())->method('process')->willReturnArgument(0);
     $this->assertTrue($this->valueChecker->isDifferentFromDefault([['sdf' => 1]], 'website', 1, ['path' => $path]));
 }
 public function testIsDifferentFromDefaultWithWebsiteScope()
 {
     $valueChecker = new ValueChecker($this->fallbackResolver, $this->appConfig, $this->valueProcessor);
     $this->fallbackResolver->expects($this->once())->method('getFallbackScope')->with('website', 1)->willReturn(['default', 0]);
     $this->appConfig->expects($this->once())->method('getValue')->with('design/head/default_title', 'default', 0)->willReturn('');
     $this->valueProcessor->expects($this->atLeastOnce())->method('process')->willReturnArgument(0);
     $this->assertTrue($valueChecker->isDifferentFromDefault('value', 'website', 1, 'design/head/default_title'));
 }
 /**
  * Test loadData
  *
  * @return void
  */
 public function testLoadData()
 {
     $this->scopeTreeMock->expects($this->any())->method('get')->willReturn(['scope' => ScopeConfigInterface::SCOPE_TYPE_DEFAULT, 'scope_id' => null, 'scopes' => [['scope' => ScopeInterface::SCOPE_WEBSITE, 'scope_id' => 1, 'scopes' => [['scope' => ScopeInterface::SCOPE_GROUP, 'scope_id' => 1, 'scopes' => [['scope' => ScopeInterface::SCOPE_STORE, 'scope_id' => 1, 'scopes' => []]]]]]]]);
     $this->metadataProviderMock->expects($this->any())->method('get')->willReturn(['first_field' => ['path' => 'first/field/path', 'use_in_grid' => 0], 'second_field' => ['path' => 'second/field/path', 'use_in_grid' => true], 'third_field' => ['path' => 'third/field/path']]);
     $this->appConfigMock->expects($this->any())->method('getValue')->willReturnMap([['second/field/path', ScopeConfigInterface::SCOPE_TYPE_DEFAULT, null, 'DefaultValue'], ['second/field/path', ScopeInterface::SCOPE_WEBSITE, 1, 'WebsiteValue'], ['second/field/path', ScopeInterface::SCOPE_STORE, 1, 'WebsiteValue']]);
     $this->valueProcessor->expects($this->atLeastOnce())->method('process')->withConsecutive(['DefaultValue', 'default', null, ['path' => 'second/field/path', 'use_in_grid' => 1]], ['WebsiteValue', 'website', 1, ['path' => 'second/field/path', 'use_in_grid' => 1]], ['WebsiteValue', 'store', 1, ['path' => 'second/field/path', 'use_in_grid' => 1]])->willReturnOnConsecutiveCalls('DefaultValue', 'WebsiteValue', 'WebsiteValue');
     $expectedResult = [new \Magento\Framework\DataObject(['store_website_id' => null, 'store_group_id' => null, 'store_id' => null, 'second_field' => 'DefaultValue']), new \Magento\Framework\DataObject(['store_website_id' => 1, 'store_group_id' => null, 'store_id' => null, 'second_field' => 'WebsiteValue']), new \Magento\Framework\DataObject(['store_website_id' => 1, 'store_group_id' => 1, 'store_id' => 1, 'second_field' => 'WebsiteValue'])];
     $this->assertEquals($expectedResult, $this->collection->getItems());
 }
 public function testLoad()
 {
     $scope = 'website';
     $scopeId = 1;
     $this->configFactory->expects($this->once())->method('create')->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('getPath')->willReturn('path');
     $this->scopeConfig->expects($this->once())->method('getValue')->with('path', $scope, $scopeId)->willReturn('value');
     $this->valueProcessor->expects($this->once())->method('process')->with('value', 'path')->willReturnArgument(0);
     $this->designConfigData->expects($this->once())->method('setValue')->with('value');
     $this->assertSame($this->designConfig, $this->model->load($scope, $scopeId));
 }