Results
19.06.2021
dopl 8.x-3.x-dev ::
tests/src/Unit/Plugin/Filter/DoplTest.php
// Mock link generator methods. $this->link_generator->expects($this->any()) ->method('generateFromLink') ->willReturn($generated_link); // Mock guzzle client. $mock = new MockHandler([ new Response(200, [], "<!doctype html><html><head><title>Test | Drupal.org</title></head><body>HTML body</body></html>"), ]);
02.06.2023
dubbot 1.0.0 ::
tests/src/Unit/RequirementsHandlerTest.php
$link_generator->generate(Argument::any(), Argument::any())->willReturn('<a href="/admin/config/content/dubbot">DubBot settings page</a>'); // This line is necessary for Drupal < 10.1. $link_generator->generateFromLink(Argument::type(Link::class))->willReturn('<a href="/admin/config/content/dubbot">DubBot settings page</a>'); $container->set('link_generator', $link_generator->reveal()); \Drupal::setContainer($container); } /** * Tests the results based on the requirements phase.
14.04.2020
dvf 2.x-dev ::
tests/src/Unit/DvfHelpersTest.php
// Mock the link generator for testGetHelpPageLink(). $linkGenerator = $this->createMock('Drupal\Core\Utility\LinkGeneratorInterface'); // Mock its generateFromLink function by creating // link markup using generated Uri. $linkGenerator->expects($this->any()) ->method('generateFromLink') ->willReturnCallback(function (Link $link) { // Since path validator mock returns null, // link has been built with Link::fromInternalUri('base:...') $uri = str_replace('base:', '/', $link->getUrl()->getUri()); $markup = '<a href="' . $uri . '">' . $link->getText() . '</a>'; $generated_link = new GeneratedLink();
23.05.2024
rabbit_hole_links 1.0.2 ::
src/RabbitHoleLinksLinkGenerator.php
* {@inheritdoc} */ public function generateFromLink(Link $link): GeneratedLink { return $this->inner->generateFromLink($link); } }
28.01.2022
sdk 8.x-2.x-dev ::
tests/src/Unit/ExternalLinkTest.php
\Drupal::linkGenerator() ->expects(static::once()) ->method('generateFromLink') ->with(static::isInstanceOf(Link::class)) ->willReturn($generated_link); $this->assertSame($generated_link, $external_link::externalLink($url, $text)); }