protected function LinkTest::mockUrlAssembler in Drupal 10
Same name and namespace in other branches
- 8 core/modules/jsonapi/tests/src/Unit/JsonApiResource/LinkTest.php \Drupal\Tests\jsonapi\Unit\JsonApiResource\LinkTest::mockUrlAssembler()
- 9 core/modules/jsonapi/tests/src/Unit/JsonApiResource/LinkTest.php \Drupal\Tests\jsonapi\Unit\JsonApiResource\LinkTest::mockUrlAssembler()
Mocks the unrouted URL assembler.
3 calls to LinkTest::mockUrlAssembler()
- LinkTest::linkComparisonProvider in core/
modules/ jsonapi/ tests/ src/ Unit/ JsonApiResource/ LinkTest.php - Provides test data for link comparison.
- LinkTest::linkMergeProvider in core/
modules/ jsonapi/ tests/ src/ Unit/ JsonApiResource/ LinkTest.php - Provides test data for link merging.
- LinkTest::testGetLinkRelationType in core/
modules/ jsonapi/ tests/ src/ Unit/ JsonApiResource/ LinkTest.php - @covers ::getLinkRelationType
File
- core/
modules/ jsonapi/ tests/ src/ Unit/ JsonApiResource/ LinkTest.php, line 133
Class
- LinkTest
- @coversDefaultClass \Drupal\jsonapi\JsonApiResource\Link @group jsonapi
Namespace
Drupal\Tests\jsonapi\Unit\JsonApiResourceCode
protected function mockUrlAssembler() {
$url_assembler = $this
->getMockBuilder(UnroutedUrlAssemblerInterface::class)
->disableOriginalConstructor()
->getMock();
$url_assembler
->method('assemble')
->willReturnCallback(function ($uri) {
return (new GeneratedUrl())
->setGeneratedUrl($uri);
});
$container = new ContainerBuilder();
$container
->set('unrouted_url_assembler', $url_assembler);
\Drupal::setContainer($container);
}