public function MenuTest::testTestSetup in GraphQL 8.3
Test if the test setup itself is successful.
File
- modules/
graphql_core/ tests/ src/ Kernel/ Menu/ MenuTest.php, line 54
Class
- MenuTest
- Test access to menu items.
Namespace
Drupal\Tests\graphql_core\Kernel\MenuCode
public function testTestSetup() {
/** @var \Drupal\Core\Menu\MenuTreeStorageInterface $menuStorage */
$menuStorage = $this->container
->get('entity_type.manager')
->getStorage('menu');
$menu = $menuStorage
->load('test');
$this
->assertIsObject($menu);
/** @var \Drupal\Core\Menu\MenuLinkTreeInterface $menuTree */
$menuTree = $this->container
->get('menu.link_tree');
$this
->assertEquals(count($menuTree
->load('test', new MenuTreeParameters())), 3);
/** @var \Symfony\Component\HttpKernel\HttpKernelInterface $httpKernel */
$httpKernel = $this->container
->get('http_kernel');
$this
->assertEquals($httpKernel
->handle(Request::create('/graphql/test/accessible'))
->getStatusCode(), 200);
$this
->assertEquals($httpKernel
->handle(Request::create('/graphql/test/inaccessible'))
->getStatusCode(), 403);
}