function LinksetControllerTest::testBasicFunctions

Same name and namespace in other branches
  1. 10 core/modules/system/tests/src/Functional/Menu/LinksetControllerTest.php \Drupal\Tests\system\Functional\Menu\LinksetControllerTest::testBasicFunctions()

Test core functions of the linkset endpoint.

Not intended to test every feature of the endpoint, only the most basic functionality.

The expected linkset also ensures that path aliasing is working properly.

Throws

\Exception

File

core/modules/system/tests/src/Functional/Menu/LinksetControllerTest.php, line 160

Class

LinksetControllerTest
Tests the behavior of the linkset controller.

Namespace

Drupal\Tests\system\Functional\Menu

Code

public function testBasicFunctions() : void {
    $this->enableEndpoint(TRUE);
    $expected_linkset = $this->getReferenceLinksetDataFromFile(__DIR__ . '/../../../fixtures/linkset/linkset-menu-main.json');
    $response = $this->doRequest('GET', Url::fromUri('base:/system/menu/main/linkset'));
    $this->assertSame('application/linkset+json', $response->getHeaderLine('content-type'));
    $this->assertSame($expected_linkset, Json::decode((string) $response->getBody()));
    $this->doRequest('GET', Url::fromUri('base:/system/menu/missing/linkset'), 404);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.