当前位置: 首页>>代码示例>>PHP>>正文


PHP NodeElement::getAttribute方法代码示例

本文整理汇总了PHP中Behat\Mink\Element\NodeElement::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeElement::getAttribute方法的具体用法?PHP NodeElement::getAttribute怎么用?PHP NodeElement::getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Behat\Mink\Element\NodeElement的用法示例。


在下文中一共展示了NodeElement::getAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: restrictElements

 /**
  * @param array[] $allowedElements
  *   Element machine names.
  */
 private function restrictElements(array $allowedElements)
 {
     // Match element tag with allowed.
     if (!isset($allowedElements[$this->tag])) {
         throw new \RuntimeException("Tag is not allowed: {$this->tag}.");
     }
     $types = $allowedElements[$this->tag];
     // Restrict by types only if they are specified.
     if (!empty($types)) {
         $type = $this->element->getAttribute('type');
         if (!in_array($type, $types)) {
             throw new \RuntimeException(sprintf('Type "%s" is not allowed for "%s" tag', $type, $this->tag));
         }
     }
 }
开发者ID:BR0kEN-,项目名称:TqExtension,代码行数:19,代码来源:FormValueAssertion.php

示例2: getEvaluation

 /**
  * Helper function how to read the evaluation from the evaluation element
  * @param  NodeElement $element
  * @return string
  */
 protected function getEvaluation($element)
 {
     $evaluation = $element->getAttribute('content');
     $evaluation = floatval($evaluation);
     $evaluation *= 2;
     return (string) $evaluation;
 }
开发者ID:BucherStoerzbachGbR,项目名称:shopware,代码行数:12,代码来源:Detail.php

示例3: createFromNode

 public static function createFromNode(NodeElement $node)
 {
     $message = $node->find('css', '.noty_text')->getHtml();
     //$x = $node->getOuterHtml();
     $class = $node->getAttribute('class');
     switch ($class) {
         case 'noty_alert':
             $type = 'alert';
             break;
         case 'noty_warning':
             $type = 'warning';
             break;
         case 'noty_error':
             $type = 'error';
             break;
         case 'noty_information':
             $type = 'information';
             break;
         case 'noty_success':
             $type = 'success';
             break;
         default:
             $type = 'default';
     }
     return new NotyMessage($node, $type, $message);
 }
开发者ID:dafik,项目名称:cc-tests-reverse,代码行数:26,代码来源:NotyMessage.php

示例4: setNode

 /**
  * @param NodeElement $node
  */
 public function setNode(NodeElement $node)
 {
     $this->node = $node;
     $this->setXpath($node->getXpath());
     $this->visible = $node->isVisible();
     $id = $node->getAttribute('id');
     if ($id) {
         $this->setId($id);
     }
     $classes = $node->getAttribute('class');
     if ($classes) {
         $this->classes = explode(' ', $classes);
     }
     $this->attributes = self::parseAttribs($node);
 }
开发者ID:dafik,项目名称:cc-tests-reverse,代码行数:18,代码来源:Element.php

示例5: fillTextField

 /**
  * Fills a text field element with $value, identified by its $label.
  *
  * @param NodeElement $label
  * @param string      $value
  */
 protected function fillTextField(NodeElement $label, $value)
 {
     if (!$label->getAttribute('for') && null !== $label->channel) {
         $label = $label->getParent()->find('css', sprintf('[data-scope="%s"] label', $label->channel));
     }
     $for = $label->getAttribute('for');
     $field = $this->find('css', sprintf('#%s', $for));
     $field->setValue($value);
 }
开发者ID:pierallard,项目名称:pim-community-dev,代码行数:15,代码来源:Form.php

示例6: testGetAttribute

 public function testGetAttribute()
 {
     $expected = 'http://...';
     $node = new NodeElement('input_tag', $this->session);
     $this->driver->expects($this->once())->method('getAttribute')->with('input_tag', 'href')->will($this->returnValue($expected));
     $this->assertEquals($expected, $node->getAttribute('href'));
 }
开发者ID:jordi12100,项目名称:Mink,代码行数:7,代码来源:NodeElementTest.php

示例7: waitForModalToAppear

 /**
  * @param NodeElement $modalContainer
  * @param string $appearClass
  *
  * @todo it really shouldn't be here :)
  */
 protected function waitForModalToAppear(NodeElement $modalContainer, $appearClass = 'in')
 {
     $this->getDocument()->waitFor(1, function () use($modalContainer, $appearClass) {
         return false !== strpos($modalContainer->getAttribute('class'), $appearClass);
     });
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:12,代码来源:SymfonyPage.php

示例8: getStars

 /**
  * @param NodeElement $element
  * @return string
  */
 protected function getStars(NodeElement $element)
 {
     return $element->getAttribute('class');
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:8,代码来源:BlogComment.php

示例9: getColumnFieldName

 /**
  * @param NodeElement $column
  *
  * @return string
  */
 private function getColumnFieldName(NodeElement $column)
 {
     return preg_replace('/.*sylius-table-column-([^ ]+).*$/', '\\1', $column->getAttribute('class'));
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:9,代码来源:TableAccessor.php

示例10: get_field_node_type

 /**
  * Find the special type of a mahara field
  *
  * We look for the class to detect the correct 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)
 {
     $specialfieldnodetypes = array('artefactchooser', 'authlist', 'autocomplete', 'calendar', 'color', 'emaillist', 'expiry', 'filebrowser', 'files', 'image', 'multitext', 'password', 'rolepermissions', 'tags', 'userlist', 'weight', 'wysiwyg');
     if ($class = $fieldnode->getAttribute('class')) {
         if (in_array($class, $specialfieldnodetypes)) {
             return $class;
         }
     }
     return false;
 }
开发者ID:rboyatt,项目名称:mahara,代码行数:19,代码来源:BehatFieldManager.php

示例11: 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

示例12: waitForTabToActivate

 /**
  * @param NodeElement $tabContainer
  */
 protected function waitForTabToActivate($tabContainer)
 {
     $this->waitFor(function () use($tabContainer) {
         return false !== strpos($tabContainer->getAttribute('class'), 'active');
     });
 }
开发者ID:benakacha,项目名称:Sylius,代码行数:9,代码来源:WebContext.php

示例13: filterLink

 /**
  * @param NodeElement $link
  *
  * @return bool|string
  */
 private function filterLink(NodeElement $link)
 {
     $href = trim($link->getAttribute('href'));
     if (empty($href) || $href === '/' || 0 === strpos($href, '#') || 0 === strpos($href, 'javascript:') || 0 === strpos($href, 'mailto:') || !preg_match('/^((https?|ftp)\\:\\/\\/)(www\\.)?.*/', $href, $matches)) {
         return false;
     }
     // дополнить относительный урл базовым (из behat.yml)
     $part = substr($href, 0, 1);
     if ('/' == $part) {
         // с учётом страницы, на которой находимся
         $href = $this->getBehatParameter('base_url') . $href;
     } elseif ('?' == $part) {
         // с учётом страницы, на которой находимся
         $href = $this->getBehatParameter('base_url') . $this->_pageMapped . $href;
     }
     return $href;
 }
开发者ID:chorry,项目名称:bolide,代码行数:22,代码来源:RbcContext.php

示例14: waitForModalToDisappear

 /**
  * @param NodeElement $modalContainer
  *
  * @throws \Exception
  */
 protected function waitForModalToDisappear($modalContainer)
 {
     $i = 0;
     while (false !== strpos($modalContainer->getAttribute('class'), 'in')) {
         if (10 === $i) {
             throw new \Exception('The confirmation modal was not closed...');
         }
         $this->getSession()->wait(100);
         ++$i;
     }
 }
开发者ID:kongqingfu,项目名称:Sylius,代码行数:16,代码来源:WebContext.php

示例15: fillTextField

 /**
  * Fills a text field element with $value, identified by its $label.
  *
  * @param \Behat\Mink\Element\NodeElement   $label
  * @param string                            $value
  */
 protected function fillTextField($label, $value)
 {
     $for = $label->getAttribute('for');
     $field = $this->find('css', sprintf('#%s', $for));
     $field->setValue($value);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:Form.php


注:本文中的Behat\Mink\Element\NodeElement::getAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。