/**
  * {@inheritdoc}
  */
 public function getData()
 {
     if (isset($this->loadedData)) {
         return $this->loadedData;
     }
     $this->loadedData = $this->dataLoader->getData();
     return $this->loadedData;
 }
 public function testGetDataWithNoItems()
 {
     $scope = 'websites';
     $scopeId = 1;
     $this->request->expects($this->exactly(2))->method('getParam')->willReturnMap([['scope', null, $scope], ['scope_id', null, $scopeId]]);
     $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->once())->method('getFieldConfig')->willReturn(['field' => 'field']);
     $this->designConfigData->expects($this->once())->method('getValue')->willReturn('value');
     $this->dataPersistor->expects($this->once())->method('get')->with('theme_design_config')->willReturn(['scope' => $scope, 'scope_id' => $scopeId]);
     $result = $this->model->getData();
     $this->assertTrue(is_array($result));
     $this->assertTrue(array_key_exists($scope, $result));
     $this->assertTrue(is_array($result[$scope]));
     $this->assertTrue(array_key_exists('scope', $result[$scope]));
     $this->assertTrue(array_key_exists('scope_id', $result[$scope]));
     $this->assertEquals($scope, $result[$scope]['scope']);
     $this->assertEquals($scopeId, $result[$scope]['scope_id']);
 }
예제 #3
0
 public function testGetData()
 {
     $data = ['test_key' => 'test_value'];
     $this->dataLoader->expects($this->once())->method('getData')->willReturn($data);
     $this->assertEquals($data, $this->model->getData());
 }