public function QueryTopicTest::testRequiresAccessTopicsPermission in Open Social 10.3.x
Test that it respects the access topics permission.
File
- modules/
social_features/ social_topic/ tests/ src/ Kernel/ GraphQL/ QueryTopicTest.php, line 205
Class
- QueryTopicTest
- Tests the topic field on the Query type.
Namespace
Drupal\Tests\social_topic\Kernel\GraphQLCode
public function testRequiresAccessTopicsPermission() {
$topic = $this
->createNode([
'type' => 'topic',
'field_content_visibility' => 'public',
'status' => NodeInterface::PUBLISHED,
]);
// Create a user that is not allowed to view public topics and comments.
$this
->setUpCurrentUser();
$this
->assertResults('
query ($id: ID!) {
topic(id: $id) {
id
}
}
', [
'id' => $topic
->uuid(),
], [
'topic' => NULL,
], $this
->defaultCacheMetaData()
->addCacheableDependency($topic)
->addCacheContexts([
'languages:language_interface',
]));
}