You are here

protected function DashboardTasksTest::setUp in farmOS 2.x

Overrides FarmBrowserTestBase::setUp

File

modules/core/ui/views/tests/src/Functional/DashboardTasksTest.php, line 48

Class

DashboardTasksTest
Tests the farm_ui_views dashboard panes.

Namespace

Drupal\Tests\farm_ui_views\Functional

Code

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

  // Create and login a user with permission to access dashboard.
  $this->user = $this
    ->createUser([
    'access farm dashboard',
  ]);
  $this
    ->drupalLogin($this->user);

  // Create a role that has permission to view log.
  $this->role = $this
    ->drupalCreateRole([
    'access farm dashboard',
    'view any log',
  ]);

  // Create a log that is done.
  $this->log = Log::create([
    'name' => 'Planned log',
    'type' => 'observation',
    'status' => 'done',
    'timestamp' => \Drupal::time()
      ->getCurrentTime() + 86400,
  ]);
  $this->log
    ->save();
}