class RestExampleMenuTest

Test the user-facing menus in Rest Example.

@group rest_example @group examples

Hierarchy

  • class \Drupal\Tests\rest_example\Functional\RestExampleMenuTest extends \Drupal\Tests\BrowserTestBase

Expanded class hierarchy of RestExampleMenuTest

Related topics

File

modules/rest_example/tests/src/Functional/RestExampleMenuTest.php, line 14

Namespace

Drupal\Tests\rest_example\Functional
View source
class RestExampleMenuTest extends BrowserTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * Modules to enable.
   *
   * @var array
   */
  protected static $modules = [
    'rest_example',
  ];
  
  /**
   * The installation profile to use with this test.
   *
   * This test class requires the "Tools" block.
   *
   * @var string
   */
  protected $profile = 'minimal';
  
  /**
   * Test for a link to the rest example in the Tools menu.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   */
  public function testRestExampleLink() {
    $this->drupalGet('');
    $this->assertSession()
      ->linkByHrefExists('examples/rest-client-actions');
    $this->assertSession()
      ->linkByHrefExists('examples/rest-client-settings');
  }
  
  /**
   * Tests rest_example menus.
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   */
  public function testRestExampleMenu() {
    $this->drupalGet('examples/rest-client-actions');
    $this->assertSession()
      ->statusCodeEquals(200);
    $this->drupalGet('examples/rest-client-settings');
    $this->assertSession()
      ->statusCodeEquals(200);
  }

}

Members

Title Sort descending Modifiers Object type Summary
RestExampleMenuTest::$defaultTheme protected property
RestExampleMenuTest::$modules protected static property Modules to enable.
RestExampleMenuTest::$profile protected property The installation profile to use with this test.
RestExampleMenuTest::testRestExampleLink public function Test for a link to the rest example in the Tools menu.
RestExampleMenuTest::testRestExampleMenu public function Tests rest_example menus.