當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NodeElement::getParent方法代碼示例

本文整理匯總了PHP中Behat\Mink\Element\NodeElement::getParent方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeElement::getParent方法的具體用法?PHP NodeElement::getParent怎麽用?PHP NodeElement::getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Behat\Mink\Element\NodeElement的用法示例。


在下文中一共展示了NodeElement::getParent方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: reverseControls

 private static function reverseControls(NodeElement $content, dTable $dt)
 {
     $wrap = $content->getParent();
     self::reverseHeader($wrap, $dt);
     self::reverseFooter($wrap, $dt);
 }
開發者ID:dafik,項目名稱:cc-tests-reverse,代碼行數:6,代碼來源:DataTable.php

示例2: findParentByClass

 /**
  * Returns the closest parent element having a specific class attribute.
  *
  * @param  NodeElement $el
  * @param  String  $class
  * @return Element|null
  */
 protected function findParentByClass(NodeElement $el, $class)
 {
     $container = $el->getParent();
     while ($container && $container->getTagName() != 'body') {
         if ($container->isVisible() && in_array($class, explode(' ', $container->getAttribute('class')))) {
             return $container;
         }
         $container = $container->getParent();
     }
     return null;
 }
開發者ID:aaronleslie,項目名稱:aaronunix,代碼行數:18,代碼來源:CmsUiContext.php

示例3: isReplyOfComment

 /**
  * @param NodeElement $reply
  * @param NodeElement $comment
  *
  * @return bool
  */
 public function isReplyOfComment(NodeElement $reply, NodeElement $comment)
 {
     return $reply->getParent()->getText() === $comment->getParent()->getText();
 }
開發者ID:noglitchyo,項目名稱:pim-community-dev,代碼行數:10,代碼來源:Edit.php

示例4: fillSelectField

 /**
  * Fills a select element with $value, identified by its $label.
  *
  * @param NodeElement $label
  * @param string      $value
  */
 protected function fillSelectField(NodeElement $label, $value)
 {
     $field = $label->getParent()->find('css', 'select');
     $field->selectOption($value);
 }
開發者ID:pierallard,項目名稱:pim-community-dev,代碼行數:11,代碼來源:Form.php

示例5: get_field_node_type

 /**
  * Recursive method to find the field type.
  *
  * Depending on the field the felement class node is in a level or in another. We
  * look recursively for a parent node with a 'felement' class to find the field type.
  *
  * @param NodeElement $fieldnode The current node.
  * @param Session $session The behat browser session
  * @return mixed A NodeElement if we continue looking for the element type and String or false when we are done.
  */
 protected static function get_field_node_type(NodeElement $fieldnode, Session $session)
 {
     // Special handling for availability field which requires custom JavaScript.
     if ($fieldnode->getAttribute('name') === 'availabilityconditionsjson') {
         return 'availability';
     }
     if ($fieldnode->getTagName() == 'html') {
         return false;
     }
     // If the type is explictly set on the element pointed to by the label - use it.
     if ($type = $fieldnode->getParent()->getAttribute('data-fieldtype')) {
         if ($type == 'tags') {
             return 'autocomplete';
         }
         return $type;
     }
     // We look for a parent node with 'felement' class.
     if ($class = $fieldnode->getParent()->getAttribute('class')) {
         if (strstr($class, 'felement') != false) {
             // Remove 'felement f' from class value.
             return substr($class, 10);
         }
         // Stop propagation through the DOM, if it does not have a felement is not part of a moodle form.
         if (strstr($class, 'fcontainer') != false) {
             return false;
         }
     }
     return self::get_field_node_type($fieldnode->getParent(), $session);
 }
開發者ID:janeklb,項目名稱:moodle,代碼行數:39,代碼來源:behat_field_manager.php

示例6: get_field_node_type

 /**
  * Recursive method to find the field type.
  *
  * Depending on the field the felement class node is in a level or in another. We
  * look recursively for a parent node with a 'felement' class to find the field type.
  *
  * @param NodeElement $fieldnode The current node.
  * @param Session $session The behat browser session
  * @return mixed A NodeElement if we continue looking for the element type and String or false when we are done.
  */
 protected static function get_field_node_type(NodeElement $fieldnode, Session $session)
 {
     // We look for a parent node with 'felement' class.
     if ($class = $fieldnode->getParent()->getAttribute('class')) {
         if (strstr($class, 'felement') != false) {
             // Remove 'felement f' from class value.
             return substr($class, 10);
         }
         // Stop propagation through the DOM, if it does not have a felement is not part of a moodle form.
         if (strstr($class, 'fcontainer') != false) {
             return false;
         }
     }
     return self::get_field_node_type($fieldnode->getParent(), $session);
 }
開發者ID:helenagarcia90,項目名稱:moodle,代碼行數:25,代碼來源:behat_field_manager.php

示例7: testGetParent

 public function testGetParent()
 {
     $node = new NodeElement('elem', $this->session);
     $parent = $this->getMockBuilder('Behat\\Mink\\Element\\NodeElement')->disableOriginalConstructor()->getMock();
     $this->driver->expects($this->once())->method('find')->with('elem/..')->will($this->returnValue(array($parent)));
     $this->selectors->expects($this->once())->method('selectorToXpath')->with('xpath', '..')->will($this->returnValue('..'));
     $this->assertSame($parent, $node->getParent());
 }
開發者ID:jordi12100,項目名稱:Mink,代碼行數:8,代碼來源:NodeElementTest.php

示例8: toggleResource

 /**
  * @param NodeElement $resource
  */
 public function toggleResource(NodeElement $resource)
 {
     $groupTitleElement = $this->spin(function () use($resource) {
         return $resource->getParent()->getParent()->getParent()->find('css', 'h3');
     }, 'Group title not found for resource.');
     $groupTitle = $groupTitleElement->getHtml();
     $this->navigateToGroup($groupTitle);
     $this->spin(function () use($resource) {
         return $resource->isVisible();
     }, sprintf('Resource is not visible on the group %s.', $groupTitle));
     $resource->click();
 }
開發者ID:a2xchip,項目名稱:pim-community-dev,代碼行數:15,代碼來源:PermissionDecorator.php

示例9: get_node_type

    /**
     * Recursive method to find the field type.
     *
     * Depending on the field the felement class node is a level or in another. We
     * look recursively for a parent node with a 'felement' class to find the field type.
     *
     * @throws ExpectationException
     * @param NodeElement $fieldnode The current node
     * @param string $locator Just to send an exception that makes sense for the user
     * @return mixed String or NodeElement depending if we have reached the felement node
     */
    protected function get_node_type(NodeElement $fieldnode, $locator) {

        // We look for a parent node with 'felement' class.
        if ($class = $fieldnode->getParent()->getAttribute('class')) {

            if (strstr($class, 'felement') != false) {
                // Remove 'felement f' from class value.
                return substr($class, 10);
            }

            // Stop propagation through the DOM, something went wrong!.
            if (strstr($class, 'fcontainer') != false) {
                throw new ExpectationException('No field type for ' . $locator . ' found, ensure the field exists', $this->getSession());
            }
        }

        return $this->get_node_type($fieldnode->getParent(), $locator);
    }
開發者ID:Burick,項目名稱:moodle,代碼行數:29,代碼來源:behat_forms.php

示例10: fillTextField

 /**
  * Fills a text field element with $value, identified by its container or label.
  *
  * @param NodeElement $fieldContainerOrLabel
  * @param string      $value
  */
 protected function fillTextField(NodeElement $fieldContainerOrLabel, $value)
 {
     $field = $fieldContainerOrLabel->find('css', 'div.field-input input');
     // no field found, we're using a label
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->getParent()->find('css', 'div.field-input input');
     }
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->find('css', 'div.controls input');
     }
     $field->setValue($value);
     $this->getSession()->executeScript('$(\'.field-input input[type="text"]\').trigger(\'change\');');
 }
開發者ID:mm999,項目名稱:pim-community-dev,代碼行數:19,代碼來源:ProductEditForm.php

示例11: fillTextField

 /**
  * Fills a text field element with $value, identified by its container or label.
  *
  * @param NodeElement $fieldContainerOrLabel
  * @param string      $value
  *
  * @throws ElementNotFoundException
  */
 protected function fillTextField(NodeElement $fieldContainerOrLabel, $value)
 {
     $field = $fieldContainerOrLabel->find('css', 'div.field-input input');
     // no field found, we're using a label
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->getParent()->find('css', 'div.field-input input');
     }
     if (!$field) {
         $field = $fieldContainerOrLabel->getParent()->find('css', 'div.controls input');
     }
     if (null === $field) {
         throw new ElementNotFoundException(sprintf('No text field can be found from "%s".', $fieldContainerOrLabel->getText()));
     }
     $field->setValue($value);
     $this->getSession()->executeScript('$(\'.field-input input[type="text"]\').trigger(\'change\');');
 }
開發者ID:a2xchip,項目名稱:pim-community-dev,代碼行數:24,代碼來源:ProductEditForm.php

示例12: get_field_node_type

 /**
  * Recursive method to find the field type.
  *
  * Depending on the field the felement class node is in a level or in another. We
  * look recursively for a parent node with a 'felement' class to find the field type.
  *
  * @param NodeElement $fieldnode The current node.
  * @param Session $session The behat browser session
  * @return mixed A NodeElement if we continue looking for the element type and String or false when we are done.
  */
 protected static function get_field_node_type(NodeElement $fieldnode, Session $session)
 {
     // Special handling for availability field which requires custom JavaScript.
     if ($fieldnode->getAttribute('name') === 'availabilityconditionsjson') {
         return 'availability';
     }
     // We look for a parent node with 'felement' class.
     if ($class = $fieldnode->getParent()->getAttribute('class')) {
         if (strstr($class, 'felement') != false) {
             // Remove 'felement f' from class value.
             return substr($class, 10);
         }
         // Stop propagation through the DOM, if it does not have a felement is not part of a moodle form.
         if (strstr($class, 'fcontainer') != false) {
             return false;
         }
     }
     return self::get_field_node_type($fieldnode->getParent(), $session);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:29,代碼來源:behat_field_manager.php


注:本文中的Behat\Mink\Element\NodeElement::getParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。