You are here

protected function PermissionsTest::setUp in GraphQL 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Kernel/Framework/PermissionsTest.php \Drupal\Tests\graphql\Kernel\Framework\PermissionsTest::setUp()

Overrides GraphQLTestBase::setUp

File

tests/src/Kernel/Framework/PermissionsTest.php, line 27

Class

PermissionsTest
Test if query handling respects permissions properly.

Namespace

Drupal\Tests\graphql\Kernel\Framework

Code

protected function setUp() {
  parent::setUp();
  $this
    ->mockField('root', [
    'name' => 'root',
    'type' => 'String',
    'secure' => TRUE,
  ], 'test');

  // Set up a query map provider.
  $queryProvider = $this
    ->prophesize(QueryProviderInterface::class);
  $queryProvider
    ->getQuery(Argument::any(), Argument::any())
    ->willReturn(NULL);
  $queryProvider
    ->getQuery('persisted:a', Argument::any())
    ->willReturn('{ root }');
  $this->container
    ->set('graphql.query_provider', $queryProvider
    ->reveal());
}