protected function LinkitAutocompleteTest::createProfile in Linkit 8.5
Creates a profile based on default settings.
@todo Do a trait of this?
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:
- label: Random string.
Return value
\Drupal\linkit\ProfileInterface The created profile entity.
1 call to LinkitAutocompleteTest::createProfile()
- LinkitAutocompleteTest::setUp in tests/
src/ Kernel/ LinkitAutocompleteTest.php
File
- tests/
src/ Kernel/ LinkitAutocompleteTest.php, line 243
Class
- LinkitAutocompleteTest
- Tests the linkit autocomplete functionality.
Namespace
Drupal\Tests\linkit\KernelCode
protected function createProfile(array $settings = []) {
// Populate defaults array.
$settings += [
'id' => mb_strtolower($this
->randomMachineName()),
'label' => $this
->randomMachineName(),
];
$profile = Profile::create($settings);
$profile
->save();
return $profile;
}