You are here

public function StyleguidePageTest::testStyleGuidePageEmpty in Simple Style Guide 8

Tests that the style guide page loads with a 200 response without config.

File

src/Tests/StyleguidePageTest.php, line 48

Class

StyleguidePageTest
Simple test to ensure that main page loads with module enabled.

Namespace

Drupal\simple_styleguide\Tests

Code

public function testStyleGuidePageEmpty() {
  $this
    ->drupalGet(Url::fromRoute('simple_styleguide.controller'));
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Assert that the no styleguide patterns text is visible.
  $no_styleguide_patterns_text = $this
    ->xpath($this
    ->cssSelectToXpath('.simple-styleguide--site-styles .site-styles--shortcuts > p'));
  $this
    ->assertEquals('You have not selected or created any styleguide patterns.', $no_styleguide_patterns_text[0]
    ->getText());

  // Assert that the configure link is visible.
  $configure_link = Url::fromRoute('simple_styleguide.styleguide_settings')
    ->toString();
  $this
    ->assertSession()
    ->linkExists('Configure Simple Styleguide');
  $this
    ->assertSession()
    ->linkByHrefExists($configure_link);
}