You are here

protected function MissingEntityReferenceTest::createChannel in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/tests/src/Functional/MissingEntityReferenceTest.php \Drupal\Tests\entity_share_client\Functional\MissingEntityReferenceTest::createChannel()

Helper function to create the channel used for the test.

Parameters

\Drupal\user\UserInterface $user: The user which credential will be used for the remote.

Overrides EntityShareClientFunctionalTestBase::createChannel

File

modules/entity_share_client/tests/src/Functional/MissingEntityReferenceTest.php, line 161

Class

MissingEntityReferenceTest
Functional test class for entity reference field with missing entity.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function createChannel(UserInterface $user) {
  parent::createChannel($user);

  // Add a channel for the node.
  $channel_storage = $this->entityTypeManager
    ->getStorage('channel');
  $channel = $channel_storage
    ->create([
    'id' => 'taxonomy_term_es_test_en',
    'label' => $this
      ->randomString(),
    'channel_entity_type' => 'taxonomy_term',
    'channel_bundle' => 'es_test',
    'channel_langcode' => static::$entityLangcode,
    'authorized_users' => [
      $user
        ->uuid(),
    ],
  ]);
  $channel
    ->save();
  $this->channels[$channel
    ->id()] = $channel;
}