Esempio n. 1
0
 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'));
 }
 /**
  * @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);
 }