You are here

protected function EntityShareClientFunctionalTestBase::createRemote in Entity Share 8.2

Same name and namespace in other branches
  1. 8.3 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 which credential 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 251

Class

EntityShareClientFunctionalTestBase
Base class for Entity share server 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>'),
    'basic_auth_username' => $user
      ->getAccountName(),
    'basic_auth_password' => $user->passRaw,
  ]);
  $remote
    ->save();
  $this->remote = $remote;
}