function TourTest::testStatus

Same name and namespace in other branches
  1. 11.x core/modules/tour/tests/src/Functional/TourTest.php \Drupal\Tests\tour\Functional\TourTest::testStatus()

Tests enabling and disabling the tour tip functionality.

File

core/modules/tour/tests/src/Functional/TourTest.php, line 245

Class

TourTest
Tests the functionality of tour tips.

Namespace

Drupal\Tests\tour\Functional

Code

public function testStatus() : void {
  // Set tour tip status as enabled.
  $tour = Tour::load('tour-test');
  $tour->setStatus(TRUE);
  $tour->save();
  $this->drupalGet('tour-test-1');
  $this->assertSession()
    ->statusCodeEquals(200);
  // Tour tips should be visible on the page.
  $this->assertTourTips();
  $tour->setStatus(FALSE);
  $tour->save();
  // Navigate and verify the tour_test_1 tip is not found with
  // appropriate classes.
  $this->drupalGet('tour-test-1');
  $this->assertSession()
    ->statusCodeEquals(200);
  // No tips expected as tour is disabled.
  $this->assertTourTips(expectEmpty: TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.