當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。