本文整理汇总了PHP中Behat\Mink\Element\NodeElement::hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeElement::hasAttribute方法的具体用法?PHP NodeElement::hasAttribute怎么用?PHP NodeElement::hasAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Behat\Mink\Element\NodeElement
的用法示例。
在下文中一共展示了NodeElement::hasAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHasAttribute
public function testHasAttribute()
{
$node = new NodeElement('input_tag', $this->session);
$this->driver->expects($this->exactly(2))->method('getAttribute')->with('input_tag', 'href')->will($this->onConsecutiveCalls(null, 'http://...'));
$this->assertFalse($node->hasAttribute('href'));
$this->assertTrue($node->hasAttribute('href'));
}
示例2: isElementEmphasized
/**
* Verifies if the element has 'special' configuration on a attribute (default -> style)
*
* @param \Behat\Mink\Element\NodeElement $el The element that we want to test
* @param string $characteristic Verify a specific characteristic from attribute
* @param string $attribute Verify a specific attribute
*
* @return boolean
*/
public function isElementEmphasized(NodeElement $el, $characteristic = null, $attribute = "style")
{
// verify it has the attribute we're looking for
if (!$el->hasAttribute($attribute)) {
return false;
}
// get the attribute
$attr = $el->getAttribute($attribute);
// check if want to test specific characteristic and if it is present
if (!empty($characteristic) && strpos($attr, $characteristic) === false) {
return false;
}
// if we're here it is emphasized
return true;
}