function DevelContainerInfoTest::testParameterDetail

Same name and namespace in other branches
  1. 4.x tests/src/Functional/DevelContainerInfoTest.php \Drupal\Tests\devel\Functional\DevelContainerInfoTest::testParameterDetail()

Tests parameter detail page.

File

tests/src/Functional/DevelContainerInfoTest.php, line 207

Class

DevelContainerInfoTest
Tests container info pages and links.

Namespace

Drupal\Tests\devel\Functional

Code

public function testParameterDetail() : void {
  $parameter_name = 'cache_bins';
  // Ensures that the page works as expected.
  $this->drupalGet('/devel/container/parameter/' . $parameter_name);
  $this->assertSession()
    ->statusCodeEquals(200);
  $this->assertSession()
    ->pageTextContains(sprintf('Parameter %s value', $parameter_name));
  // Ensures that the page returns a 404 error if the requested parameter is
  // not defined.
  $this->drupalGet('/devel/container/parameter/not_exists');
  $this->assertSession()
    ->statusCodeEquals(404);
  // Ensures that the page is accessible ony to users with the adequate
  // permissions.
  $this->drupalLogout();
  $this->drupalGet('devel/container/service/' . $parameter_name);
  $this->assertSession()
    ->statusCodeEquals(403);
}