/** * @covers Mage_Core_Model_Layout_ScheduledStructure::flushScheduledStructure */ public function testFlushScheduledStructure() { $this->assertNotEmpty($this->_model->getPaths()); $this->assertNotEmpty($this->_model->getElements()); $this->assertNotEmpty($this->_model->getStructure()); $this->_model->flushScheduledStructure(); $this->assertEmpty($this->_model->getPaths()); $this->assertEmpty($this->_model->getElements()); $this->assertEmpty($this->_model->getStructure()); }
/** * Destroy previous element with same name and all its children, if new element overrides it * * This is a workaround to handle situation, when an element emerges with name of element that already exists. * In this case we destroy entire structure of the former element and replace with the new one. * * @param string $name * @param string $path */ protected function _overrideElementWorkaround($name, $path) { if ($this->_scheduledStructure->hasStructureElement($name)) { foreach ($this->_scheduledStructure->getPaths() as $potentialChild => $childPath) { if (0 === strpos($childPath, "{$path}/")) { $this->_scheduledStructure->unsetPathElement($potentialChild); $this->_scheduledStructure->unsetStructureElement($potentialChild); } } } }