You are here

protected function EntityShareClientFunctionalTestBase::createRemote in Entity Share 8.3

Same name and namespace in other branches
  1. 8.2 modules/entity_share_client/tests/src/Functional/EntityShareClientFunctionalTestBase.php \Drupal\Tests\entity_share_client\Functional\EntityShareClientFunctionalTestBase::createRemote()

Helper function to create the remote that point to the site itself.

Parameters

\Drupal\user\UserInterface $user: The user whose credentials will be used for the remote.

1 call to EntityShareClientFunctionalTestBase::createRemote()
EntityShareClientFunctionalTestBase::setUp in modules/entity_share_client/tests/src/Functional/EntityShareClientFunctionalTestBase.php

File

modules/entity_share_client/tests/src/Functional/EntityShareClientFunctionalTestBase.php, line 309

Class

EntityShareClientFunctionalTestBase
Base class for Entity Share Client functional tests.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

protected function createRemote(UserInterface $user) {
  $remote_storage = $this->entityTypeManager
    ->getStorage('remote');
  $remote = $remote_storage
    ->create([
    'id' => $this
      ->randomMachineName(),
    'label' => $this
      ->randomString(),
    'url' => $this
      ->buildUrl('<front>'),
  ]);
  $plugin = $this
    ->createAuthenticationPlugin($user, $remote);
  $remote
    ->mergePluginConfig($plugin);

  // Save the "Remote" config entity.
  $remote
    ->save();
  $this->remote = $remote;
}