public function QueryTopicTypesTest::testAnonymousUserCanAccessTopicTypes in Open Social 10.3.x
Test that a anonymous user can access topic types.
File
- modules/
social_features/ social_topic/ tests/ src/ Kernel/ GraphQL/ QueryTopicTypesTest.php, line 76
Class
- QueryTopicTypesTest
- Tests the topicTypes field on the Query type.
Namespace
Drupal\Tests\social_topic\Kernel\GraphQLCode
public function testAnonymousUserCanAccessTopicTypes() {
$term = \Drupal::entityTypeManager()
->getStorage('taxonomy_term')
->create([
'vid' => 'topic_types',
'name' => $this
->randomString(),
]);
$term
->save();
$this
->setUpCurrentUser([], [
'access content',
]);
$this
->assertResults('
query {
topicTypes {
id
label
}
}
', [], [
'topicTypes' => [
[
'id' => $term
->uuid(),
'label' => $term
->label(),
],
],
], $this
->defaultCacheMetaData()
->addCacheableDependency($term)
->addCacheContexts([
'languages:language_interface',
]));
}