public function MenuTest::testMenuTree in GraphQL 8.3
Test menu tree data retrieval.
File
- modules/
graphql_core/ tests/ src/ Kernel/ Menu/ MenuTest.php, line 74
Class
- MenuTest
- Test access to menu items.
Namespace
Drupal\Tests\graphql_core\Kernel\MenuCode
public function testMenuTree() {
$metadata = $this
->defaultCacheMetaData();
$metadata
->addCacheTags([
'config:system.menu.test',
]);
$this
->assertResults($this
->getQueryFromFile('menu.gql'), [], [
'info' => [
'name' => 'Test menu',
'description' => 'Menu for testing GraphQL menu access.',
],
'menu' => [
'links' => [
0 => [
'label' => 'Accessible',
'route' => [
'path' => '/graphql/test/accessible',
'routed' => TRUE,
],
'attribute' => NULL,
'links' => [
0 => [
'label' => 'Nested A',
'attribute' => NULL,
'route' => [
'path' => '/graphql/test/accessible',
'routed' => TRUE,
],
],
1 => [
'label' => 'Nested B',
'route' => [
'path' => '/graphql/test/accessible',
'routed' => TRUE,
],
'attribute' => NULL,
],
],
],
1 => [
'label' => 'Drupal',
'route' => [
'path' => 'http://www.drupal.org',
'routed' => FALSE,
],
'attribute' => NULL,
'links' => [],
],
],
],
], $metadata);
}