protected function PreviewLinkAccessTest::getNewPreviewLinkForEntity in Preview Link 8
Same name and namespace in other branches
- 2.x tests/src/Functional/PreviewLinkAccessTest.php \Drupal\Tests\preview_link\Functional\PreviewLinkAccessTest::getNewPreviewLinkForEntity()
- 2.0.x tests/src/Functional/PreviewLinkAccessTest.php \Drupal\Tests\preview_link\Functional\PreviewLinkAccessTest::getNewPreviewLinkForEntity()
Get a saved preview link for an entity.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: A content entity.
Return value
\Drupal\preview_link\Entity\PreviewLinkInterface|null The preview link, or null if no preview link generated.
3 calls to PreviewLinkAccessTest::getNewPreviewLinkForEntity()
- PreviewLinkAccessTest::testPreviewFakeToken in tests/
src/ Functional/ PreviewLinkAccessTest.php - Test access with tokens.
- PreviewLinkAccessTest::testPreviewLinkEnabledEntityTypesConfiguration in tests/
src/ Functional/ PreviewLinkAccessTest.php - Test the preview link routes based on the settings.
- PreviewLinkAccessTest::testPreviewRealToken in tests/
src/ Functional/ PreviewLinkAccessTest.php - Ensure access is allowed with a real token.
File
- tests/
src/ Functional/ PreviewLinkAccessTest.php, line 165
Class
- PreviewLinkAccessTest
- Test access to preview pages with valid/invalid tokens.
Namespace
Drupal\Tests\preview_link\FunctionalCode
protected function getNewPreviewLinkForEntity(ContentEntityInterface $entity) {
/** @var \Drupal\preview_link\PreviewLinkStorage $storage */
$storage = $this->container
->get('entity_type.manager')
->getStorage('preview_link');
return $storage
->createPreviewLinkForEntity($entity);
}