You are here

protected function ProfileCreationTrait::createProfile in Linkit 8.5

Creates a profile based on default settings.

Parameters

array $settings: (optional) An associative array of settings for the profile, as used in entity_create(). Override the defaults by specifying the key and value in the array. The following defaults are provided:

  • id: Random string.
  • label: Random string.

Return value

\Drupal\linkit\ProfileInterface The created profile entity.

8 calls to ProfileCreationTrait::createProfile()
LinkitControllerTest::setUp in tests/src/Functional/Controller/LinkitControllerTest.php
LinkitDialogTest::setUp in tests/src/FunctionalJavascript/LinkitDialogTest.php
LinkitEditorLinkDialogTest::setUp in tests/src/Kernel/LinkitEditorLinkDialogTest.php
Sets up the test.
MatcherAdminTest::setUp in tests/src/Functional/MatcherAdminTest.php
ProfileAdminTest::testOverview in tests/src/Functional/ProfileAdminTest.php
Test the overview page.

... See full list

File

src/Tests/ProfileCreationTrait.php, line 28

Class

ProfileCreationTrait
Provides methods to create profiles based on default settings.

Namespace

Drupal\linkit\Tests

Code

protected function createProfile(array $settings = []) {

  // Populate defaults array.
  $settings += [
    'id' => mb_strtolower($this
      ->randomMachineName()),
    'label' => $this
      ->randomMachineName(),
  ];
  $profile = Profile::create($settings);
  $profile
    ->save();
  $profile = Profile::load($profile
    ->id());
  return $profile;
}