You are here

protected function LinkCheckerLinkExtractionTest::getLinkCheckerLinkByUrl in Link checker 8

Get a link checker link entity by the given URl.

Parameters

string $url: The url.

Return value

\Drupal\Core\Entity\EntityInterface|mixed A link checker link entity when found, else NULL.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to LinkCheckerLinkExtractionTest::getLinkCheckerLinkByUrl()
LinkCheckerLinkExtractionTest::testLinkCheckerCreateNodeWithLinks in tests/src/Functional/LinkCheckerLinkExtractionTest.php

File

tests/src/Functional/LinkCheckerLinkExtractionTest.php, line 439

Class

LinkCheckerLinkExtractionTest
Test Link checker module link extraction functionality.

Namespace

Drupal\Tests\linkchecker\Functional

Code

protected function getLinkCheckerLinkByUrl(string $url) {
  $links = \Drupal::entityTypeManager()
    ->getStorage('linkcheckerlink')
    ->loadByProperties([
    'urlhash' => LinkCheckerLink::generateHash($url),
  ]);
  return current($links);
}