public function DashboardTasksTest::testUpcomingTasks in farmOS 2.x
Test the upcoming tasks view on the dashboard.
File
- modules/
core/ ui/ views/ tests/ src/ Functional/ DashboardTasksTest.php, line 71
Class
- DashboardTasksTest
- Tests the farm_ui_views dashboard panes.
Namespace
Drupal\Tests\farm_ui_views\FunctionalCode
public function testUpcomingTasks() {
$this
->drupalGet('/dashboard');
$this
->assertSession()
->statusCodeEquals(200);
// Assert that the upcoming tasks view was not added.
$this
->assertSession()
->pageTextNotContains('Upcoming tasks');
// Grant the user permission to view any log.
$this->user
->addRole($this->role);
$this->user
->save();
// Assert that the upcoming tasks view is added.
$this
->drupalGet('/dashboard');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('Upcoming tasks');
// Assert that the log is not displayed.
$this
->assertSession()
->pageTextContains('No logs found.');
// Mark the log as pending in the future.
$this->log->status = 'pending';
$this->log->timestamp = \Drupal::time()
->getCurrentTime() + 86400;
$this->log
->save();
// Assert that the upcoming tasks view is added.
$this
->drupalGet('/dashboard');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('Upcoming tasks');
// Assert that the log is displayed.
$this
->assertSession()
->pageTextContains($this->log
->label());
}