function DevelContainerInfoTest::testParameterDetail

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

Tests parameter detail page.

File

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

Class

DevelContainerInfoTest
Tests container info pages and links.

Namespace

Drupal\Tests\devel\Functional

Code

public function testParameterDetail() {
    $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("Parameter {$parameter_name} value");
    // 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);
}