51 $this->request = $this->getMockBuilder(\
Magento\Framework\
App\Request\Http::class)
52 ->disableOriginalConstructor()
54 $this->dataPersistor = $this->getMockBuilder(\
Magento\Framework\
App\Request\DataPersistorInterface::class)
55 ->getMockForAbstractClass();
56 $this->designConfigRepository = $this->getMockBuilder(\
Magento\
Theme\Api\DesignConfigRepositoryInterface::class)
57 ->getMockForAbstractClass();
58 $this->designConfig = $this->getMockBuilder(\
Magento\
Theme\Api\
Data\DesignConfigInterface::class)
59 ->getMockForAbstractClass();
60 $this->designConfigData = $this->getMockBuilder(\
Magento\
Theme\Api\
Data\DesignConfigDataInterface::class)
61 ->getMockForAbstractClass();
62 $this->designConfigExtension = $this->getMockBuilder(
64 )->setMethods([
'getDesignConfigData'])->getMockForAbstractClass();
68 $this->designConfigRepository,
78 $this->request->expects($this->exactly(2))
81 [
'scope',
null, $scope],
82 [
'scope_id',
null, $scopeId],
85 $this->designConfigRepository->expects($this->once())
86 ->method(
'getByScope')
87 ->with($scope, $scopeId)
88 ->willReturn($this->designConfig);
89 $this->designConfig->expects($this->once())
90 ->method(
'getExtensionAttributes')
91 ->willReturn($this->designConfigExtension);
92 $this->designConfigExtension->expects($this->once())
93 ->method(
'getDesignConfigData')
94 ->willReturn([$this->designConfigData]);
95 $this->designConfigData->expects($this->once())
96 ->method(
'getFieldConfig')
97 ->willReturn([
'field' =>
'field']);
98 $this->designConfigData->expects($this->once())
100 ->willReturn(
'value');
101 $this->dataPersistor->expects($this->once())
103 ->with(
'theme_design_config')
104 ->willReturn([
'scope' => $scope,
'scope_id' => $scopeId]);
105 $this->dataPersistor->expects($this->once())
107 ->with(
'theme_design_config');
109 $result = $this->model->getData();
111 $this->assertTrue(is_array(
$result));
112 $this->assertTrue(array_key_exists($scope,
$result));
113 $this->assertTrue(is_array(
$result[$scope]));
114 $this->assertTrue(array_key_exists(
'scope',
$result[$scope]));
115 $this->assertTrue(array_key_exists(
'scope_id',
$result[$scope]));
116 $this->assertEquals($scope,
$result[$scope][
'scope']);
117 $this->assertEquals($scopeId,
$result[$scope][
'scope_id']);