You are here

protected function LinkOutputLocationTest::setUp in Flag 8.4

Overrides FlagTestBase::setUp

File

tests/src/Functional/LinkOutputLocationTest.php, line 47

Class

LinkOutputLocationTest
Tests the Flag link is output in various locations.

Namespace

Drupal\Tests\flag\Functional

Code

protected function setUp() {
  parent::setUp();

  // Create a flag.
  $this->flag = $this
    ->createFlag('node', [
    'article',
  ], 'reload');

  // Log in as the admin user so we don't have to worry about flag access.
  $this
    ->grantFlagPermissions($this->flag);
  $this
    ->drupalLogin($this->adminUser);

  // Create a node to flag.
  $this->node = Node::create([
    'body' => [
      [
        'value' => $this
          ->randomMachineName(32),
        'format' => filter_default_format(),
      ],
    ],
    'type' => 'article',
    'title' => $this
      ->randomMachineName(8),
    'uid' => $this->adminUser
      ->id(),
    'status' => 1,
    // Promoted to front page to test teaser view mode.
    'promote' => 1,
    'sticky' => 0,
  ]);
  $this->node
    ->save();
}