19 use Magento\Framework\Config\DataInterfaceFactory;
40 private $dataConfigFactory;
59 $this->helper = $this->getMockBuilder(Helper::class)
60 ->setMethods([
'scheduleStructure'])
61 ->disableOriginalConstructor()
63 $this->context = $this->getMockBuilder(Context::class)
64 ->setMethods([
'getScheduledStructure',
'setElementToIfconfigList'])
65 ->disableOriginalConstructor()
67 $this->dataConfigFactory = $this->getMockBuilder(DataInterfaceFactory::class)
68 ->disableOriginalConstructor()
69 ->setMethods([
'create'])
71 $this->dataConfig = $this->getMockBuilder(DataInterface::class)
72 ->disableOriginalConstructor()
74 $this->readerPool = $this->getMockBuilder(ReaderPool::class)
75 ->disableOriginalConstructor()
79 $this->model =
new UiComponent($this->helper, $condition, $this->dataConfigFactory, $this->readerPool);
85 $this->assertEquals(
$data, $this->model->getSupportedNodes());
95 $scheduleStructure = $this->getMockBuilder(ScheduledStructure::class)
96 ->disableOriginalConstructor()
98 $this->context->expects($this->any())->method(
'getScheduledStructure')->will(
99 $this->returnValue($scheduleStructure)
101 $this->helper->expects($this->any())->method(
'scheduleStructure')->with(
105 )->willReturn(
$element->getAttribute(
'name'));
107 $scheduleStructure->expects($this->once())->method(
'setStructureElementData')->with(
112 'component' =>
'listing',
113 'aclResource' =>
'test_acl',
114 'visibilityConditions' => [
116 'name' => ConfigCondition::class,
118 'configPath' =>
'config_path' 122 'name' => AclCondition::class,
131 $this->dataConfigFactory->expects($this->once())
133 ->with([
'componentName' =>
$element->getAttribute(
'name')])
134 ->willReturn($this->dataConfig);
135 $xml =
'<?xml version="1.0"?>' 136 .
'<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' 139 $this->dataConfig->expects($this->once())
141 ->with(
$element->getAttribute(
'name'))
154 $this->readerPool->expects($this->once())
155 ->method(
'interpret')
156 ->with($this->context, $this->isInstanceOf(Element::class));
158 $this->model->interpret($this->context,
$element);
170 name="cms_block_listing" 171 aclResource="test_acl" 173 ifconfig="config_path" 174 ><visibilityCondition name="test_name" className="name"></visibilityCondition></uiComponent>',
188 $xml = simplexml_load_string(
189 '<parent_element>' . $xml .
'</parent_element>',
192 return $xml->{$elementType};
getElement($xml, $elementType)