private function UrlTest::hasAttribute in Drupal 8
Checks for class existence in link.
Parameters
$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/ Functional/ Common/ UrlTest.php - Tests that default and custom attributes are handled correctly on links.
File
- core/
modules/ system/ tests/ src/ Functional/ Common/ UrlTest.php, line 215
Class
- UrlTest
- Confirm that \Drupal\Core\Url, \Drupal\Component\Utility\UrlHelper::filterQueryParameters(), \Drupal\Component\Utility\UrlHelper::buildQuery(), and \Drupal\Core\Utility\LinkGeneratorInterface::generate() work correctly with various input.
Namespace
Drupal\Tests\system\Functional\CommonCode
private function hasAttribute($attribute, $link, $class) {
return (bool) preg_match('|' . $attribute . '="([^\\"\\s]+\\s+)*' . $class . '|', $link);
}