You are here

protected function LinkCheckerInterfaceTest::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

2 calls to LinkCheckerInterfaceTest::getLinkCheckerLinkByUrl()
LinkCheckerInterfaceTest::testLinkCheckerCreateBlockWithBrokenLinks in tests/src/Functional/LinkCheckerInterfaceTest.php
Test block with link.
LinkCheckerInterfaceTest::testLinkCheckerCreateNodeWithBrokenLinks in tests/src/Functional/LinkCheckerInterfaceTest.php
Test node with link.

File

tests/src/Functional/LinkCheckerInterfaceTest.php, line 217

Class

LinkCheckerInterfaceTest
Test case for interface tests.

Namespace

Drupal\Tests\linkchecker\Functional

Code

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