You are here

protected function CommentViewAccessTest::setUp in Open Social 10.3.x

Same name and namespace in other branches
  1. 10.2.x modules/social_features/social_comment/tests/src/Kernel/CommentViewAccessTest.php \Drupal\Tests\social_comment\Kernel\CommentViewAccessTest::setUp()

Overrides EntityKernelTestBase::setUp

File

modules/social_features/social_comment/tests/src/Kernel/CommentViewAccessTest.php, line 60

Class

CommentViewAccessTest
Tests comment view level access.

Namespace

Drupal\Tests\social_comment\Kernel

Code

protected function setUp() : void {
  parent::setUp();

  // Manually enable query_access checks, until `use_entity_access_api` is no
  // longer a setting. Installing all the `social_core` config doesn't work at
  // the time of writing. This must happen before the comment entity is
  // installed or its handlers will be incorrect.
  $this
    ->config('social_core.settings')
    ->set('use_entity_access_api', TRUE)
    ->save(TRUE);
  $this
    ->installEntitySchema('node');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('comment');
  $this
    ->installSchema('comment', 'comment_entity_statistics');
  $this
    ->installConfig([
    'filter',
    'comment',
    'social_comment',
  ]);
  $this->storage = $this->entityTypeManager
    ->getStorage('comment');
  $this->node = $this
    ->createNode();
}