function HalLinkManagerTest::testGetTypeUri
Same name in other branches
- 9 core/modules/hal/tests/src/Kernel/HalLinkManagerTest.php \Drupal\Tests\hal\Kernel\HalLinkManagerTest::testGetTypeUri()
@covers ::getTypeUri @dataProvider providerTestGetTypeUri @expectedDeprecation The deprecated alter hook hook_rest_type_uri_alter() is implemented in these functions: hal_test_rest_type_uri_alter. This hook is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.0. Implement hook_hal_type_uri_alter() instead.
File
-
core/
modules/ hal/ tests/ src/ Kernel/ HalLinkManagerTest.php, line 63
Class
- HalLinkManagerTest
- @coversDefaultClass \Drupal\hal\LinkManager\LinkManager @group hal @group legacy
Namespace
Drupal\Tests\hal\KernelCode
public function testGetTypeUri($link_domain, $entity_type, $bundle, 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\rest\LinkManager\TypeLinkManagerInterface $type_manager */
$type_manager = \Drupal::service('hal.link_manager.type');
$link = $type_manager->getTypeUri($entity_type, $bundle, $context);
$this->assertSame($link, str_replace('BASE_URL/', Url::fromRoute('<front>', [], [
'absolute' => TRUE,
])->toString(), $expected_return));
$this->assertEquals($context, $expected_context);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.