5 * Contains \Drupal\linkit\Tests\LinkitTestBase.
8 namespace Drupal\linkit\Tests;
10 use Drupal\Component\Utility\Unicode;
11 use Drupal\linkit\Entity\Profile;
12 use Drupal\simpletest\WebTestBase;
15 * Sets up page and article content types.
17 abstract class LinkitTestBase extends WebTestBase {
22 * Enable block module to get the local_actions_block to work.
26 public static $modules = ['linkit', 'linkit_test', 'block'];
29 * A user with the 'administer linkit profiles' permission.
31 * @var \Drupal\user\UserInterface
36 * A user without the 'administer linkit profiles' permission.
38 * @var \Drupal\user\UserInterface
45 protected function setUp() {
47 $this->adminUser = $this->drupalCreateUser(['administer linkit profiles']);
48 $this->baseUser = $this->drupalCreateUser();
50 $this->drupalPlaceBlock('page_title_block', ['region' => 'content']);
51 $this->drupalPlaceBlock('local_tasks_block', ['region' => 'content']);
52 $this->drupalPlaceBlock('local_actions_block', ['region' => 'content']);
53 $this->drupalPlaceBlock('system_messages_block', ['region' => 'highlighted']);
57 * Creates a profile based on default settings.
59 * @param array $settings
60 * (optional) An associative array of settings for the profile, as used in
61 * entity_create(). Override the defaults by specifying the key and value
64 * The following defaults are provided:
65 * - label: Random string.
67 * @return \Drupal\linkit\ProfileInterface
68 * The created profile entity.
70 protected function createProfile(array $settings = []) {
71 // Populate defaults array.
73 'id' => Unicode::strtolower($this->randomMachineName()),
74 'label' => $this->randomMachineName(),
77 $profile = Profile::create($settings);