本文整理匯總了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;
}