예제 #1
0
 public function testPrepare()
 {
     /**
      * @TODO: Need to use ObjectManager instead 'new'.
      * On this moment we have next bug MAGETWO-4274 which blocker for this key.
      */
     $this->_model = new \Magento\Framework\View\Layout\Element(__DIR__ . '/_files/_layout_update.xml', 0, true);
     list($blockNode) = $this->_model->xpath('//block[@name="head"]');
     list($actionNode) = $this->_model->xpath('//action[@method="setTitle"]');
     $this->assertEmpty($blockNode->attributes()->parent);
     $this->assertEmpty($actionNode->attributes()->block);
     $this->_model->prepare();
     $this->assertEquals('root', (string) $blockNode->attributes()->parent);
     $this->assertEquals('Magento\\Backend\\Block\\Page\\Head', (string) $blockNode->attributes()->class);
     $this->assertEquals('head', (string) $actionNode->attributes()->block);
 }
예제 #2
0
 /**
  * Validate node's declared position in hierarchy and add errors to the specified array if found
  *
  * @param \SimpleXMLElement $node
  * @param \Magento\Framework\View\Layout\Element $xml
  * @param array &$errors
  */
 protected function _collectHierarchyErrors($node, $xml, &$errors)
 {
     $name = $node->getName();
     $refName = $node->getAttribute('type') == $node->getAttribute('parent');
     if ($refName) {
         $refNode = $xml->xpath("/layouts/{$refName}");
         if (!$refNode) {
             $errors[$name][] = "Node '{$refName}', referenced in hierarchy, does not exist";
         }
     }
 }
예제 #3
0
 /**
  * Validate node's declared position in hierarchy and add errors to the specified array if found
  *
  * @param \SimpleXMLElement $node
  * @param \Magento\Framework\View\Layout\Element $xml
  * @param array &$errors
  */
 protected function _collectHierarchyErrors($node, $xml, &$errors)
 {
     $name = $node->getName();
     $refName = $node->getAttribute('type') == $node->getAttribute('parent');
     if ($refName) {
         $refNode = $xml->xpath("/layouts/{$refName}");
         if (!$refNode) {
             if ($refName == 'checkout_cart_configure' || $refName == 'checkout_cart_configurefailed') {
                 $this->markTestIncomplete('MAGETWO-9182');
             }
             $errors[$name][] = "Node '{$refName}', referenced in hierarchy, does not exist";
         }
     }
 }