You are here

protected function BasicFieldsTest::createChannel in Entity Share 8.3

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/BasicFieldsTest.php, line 338

Class

BasicFieldsTest
General functional test class.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function createChannel(UserInterface $user) {
  parent::createChannel($user);
  $channel_storage = $this->entityTypeManager
    ->getStorage('channel');

  // Add a channel for untranslatable entities.
  $channel = $channel_storage
    ->create([
    'id' => 'entity_test_not_translatable_entity_test_not_translatable_' . LanguageInterface::LANGCODE_NOT_SPECIFIED,
    'label' => $this
      ->randomString(),
    'channel_entity_type' => 'entity_test_not_translatable',
    'channel_bundle' => 'entity_test_not_translatable',
    'channel_langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
    'authorized_users' => [
      $user
        ->uuid(),
    ],
  ]);
  $channel
    ->save();
  $this->channels[$channel
    ->id()] = $channel;

  // Add a channel for untranslatable entities with empty langcode.
  $channel = $channel_storage
    ->create([
    'id' => 'entity_test_not_translatable_el_entity_test_not_translatable_el_' . LanguageInterface::LANGCODE_NOT_SPECIFIED,
    'label' => $this
      ->randomString(),
    'channel_entity_type' => 'entity_test_not_translatable_el',
    'channel_bundle' => 'entity_test_not_translatable_el',
    'channel_langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
    'authorized_users' => [
      $user
        ->uuid(),
    ],
  ]);
  $channel
    ->save();
  $this->channels[$channel
    ->id()] = $channel;
}