public function HalLinkManagerTest::testGetRelationUri in Drupal 9
Same name and namespace in other branches
- 8 core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php \Drupal\Tests\hal\Kernel\HalLinkManagerTest::testGetRelationUri()
@covers ::getRelationUri @dataProvider providerTestGetRelationUri
File
- core/
modules/ hal/ tests/ src/ Kernel/ HalLinkManagerTest.php, line 140
Class
- HalLinkManagerTest
- @coversDefaultClass \Drupal\hal\LinkManager\LinkManager @group hal
Namespace
Drupal\Tests\hal\KernelCode
public function testGetRelationUri($link_domain, $entity_type, $bundle, $field_name, array $context, $expected_return, array $expected_context) {
$hal_settings = \Drupal::configFactory()
->getEditable('hal.settings');
if ($link_domain === NULL) {
$hal_settings
->clear('link_domain');
}
else {
$hal_settings
->set('link_domain', $link_domain)
->save(TRUE);
}
/** @var \Drupal\hal\LinkManager\RelationLinkManagerInterface $relation_manager */
$relation_manager = \Drupal::service('hal.link_manager.relation');
$link = $relation_manager
->getRelationUri($entity_type, $bundle, $field_name, $context);
$this
->assertSame($link, str_replace('BASE_URL/', Url::fromRoute('<front>', [], [
'absolute' => TRUE,
])
->toString(), $expected_return));
$this
->assertEquals($context, $expected_context);
}