function LinksetControllerTestBase::getReferenceLinksetDataFromFile
Same name in other branches
- 11.x core/modules/system/tests/src/Functional/Menu/LinksetControllerTestBase.php \Drupal\Tests\system\Functional\Menu\LinksetControllerTestBase::getReferenceLinksetDataFromFile()
Retrieve reference linkset controller output adjusted for proper base URL.
Parameters
string $filename: Name of the file to read.
Return value
mixed The Json representation of the reference data in the file.
3 calls to LinksetControllerTestBase::getReferenceLinksetDataFromFile()
- LinksetControllerMultiLingualTest::testBasicMultilingualFunctions in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerMultiLingualTest.php - Test core functions of the linkset for multilingual behavior.
- LinksetControllerMultiLingualTest::testDefaultMultilingualFunctions in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerMultiLingualTest.php - Test core functions of the linkset for multilingual behavior.
- LinksetControllerTest::testBasicFunctions in core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerTest.php - Test core functions of the linkset endpoint.
File
-
core/
modules/ system/ tests/ src/ Functional/ Menu/ LinksetControllerTestBase.php, line 162
Class
- LinksetControllerTestBase
- A base class for implementing LinksetController tests.
Namespace
Drupal\Tests\system\Functional\MenuCode
protected function getReferenceLinksetDataFromFile(string $filename) {
$data = Json::decode(file_get_contents($filename));
// Ensure that the URLs are correct if Drupal is being served from a
// subdirectory.
$data['linkset'][0]['anchor'] = Url::fromUri('base:' . $data['linkset'][0]['anchor'])->toString();
foreach ($data['linkset'][0]['item'] as &$item) {
$item['href'] = Url::fromUri('base:' . $item['href'])->toString();
}
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.