/** * @param bool $parentName * @param array $containerConfig * @param bool $result * @dataProvider isManipulationAllowedDataProvider */ public function testIsManipulationAllowed($parentName, $containerConfig, $result) { $elementName = 'element_name'; $this->structureMock->expects($this->once())->method('getParentId')->with($this->equalTo($elementName))->will($this->returnValue($parentName)); if ($parentName) { $this->structureMock->expects($this->once())->method('hasElement')->with($this->equalTo($parentName))->will($this->returnValue($containerConfig['has_element'])); if ($containerConfig['has_element']) { $this->structureMock->expects($this->once())->method('getAttribute')->with($this->equalTo($parentName), $this->equalTo('type'))->will($this->returnValue($containerConfig['attribute'])); } } $this->assertSame($result, $this->model->isManipulationAllowed($elementName)); }
public function testIsManipulationAllowed() { $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', 'block1'); $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', 'block2', 'block1'); $this->assertFalse($this->_layout->isManipulationAllowed('block1')); $this->assertFalse($this->_layout->isManipulationAllowed('block2')); $this->_layout->addContainer('container1', 'Container 1'); $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', 'block3', 'container1'); $this->_layout->addContainer('container2', 'Container 2', [], 'container1'); $this->assertFalse($this->_layout->isManipulationAllowed('container1')); $this->assertTrue($this->_layout->isManipulationAllowed('block3')); $this->assertTrue($this->_layout->isManipulationAllowed('container2')); }
/** * {@inheritdoc} */ public function isManipulationAllowed($name) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'isManipulationAllowed'); if (!$pluginInfo) { return parent::isManipulationAllowed($name); } else { return $this->___callPlugins('isManipulationAllowed', func_get_args(), $pluginInfo); } }