You are here

public function NodeTypeExampleTest::testNodeTypeExample in Examples for Developers 8

Same name and namespace in other branches
  1. 3.x modules/node_type_example/tests/src/Functional/NodeTypeExampleTest.php \Drupal\Tests\node_type_example\Functional\NodeTypeExampleTest::testNodeTypeExample()

Verify and validate that default menu links were loaded for this module.

File

node_type_example/tests/src/Functional/NodeTypeExampleTest.php, line 60

Class

NodeTypeExampleTest
Test that our content types are successfully created.

Namespace

Drupal\Tests\node_type_example\Functional

Code

public function testNodeTypeExample() {
  $assert = $this
    ->assertSession();

  // Test that our page loads.
  $this
    ->drupalGet('/examples/node-type-example');
  $assert
    ->statusCodeEquals(200);

  // Test that our menu links were created.
  $links = $this
    ->providerMenuLinks();
  foreach ($links as $page => $path) {
    $this
      ->drupalGet($page);
    $assert
      ->linkByHrefExists($path);
  }
}