function UrlTest::hasAttribute
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Common/UrlTest.php \Drupal\Tests\system\Kernel\Common\UrlTest::hasAttribute()
- 8.9.x core/modules/system/tests/src/Functional/Common/UrlTest.php \Drupal\Tests\system\Functional\Common\UrlTest::hasAttribute()
- 11.x core/modules/system/tests/src/Kernel/Common/UrlTest.php \Drupal\Tests\system\Kernel\Common\UrlTest::hasAttribute()
Checks for class existence in link.
Parameters
$attribute: Attribute to be checked.
$link: URL to search.
$class: Element class to search for.
Return value
bool TRUE if the class is found, FALSE otherwise.
1 call to UrlTest::hasAttribute()
- UrlTest::testLinkAttributes in core/
modules/ system/ tests/ src/ Kernel/ Common/ UrlTest.php - Tests that default and custom attributes are handled correctly on links.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Common/ UrlTest.php, line 178
Class
- UrlTest
- Tests the Url object.
Namespace
Drupal\Tests\system\Kernel\CommonCode
private function hasAttribute($attribute, $link, $class) {
return (bool) preg_match('|' . $attribute . '="([^\\"\\s]+\\s+)*' . $class . '|', $link);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.