function DevelContainerInfoTest::testServiceDetail

Tests service detail page.

File

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

Class

DevelContainerInfoTest
Tests container info pages and links.

Namespace

Drupal\Tests\devel\Functional

Code

public function testServiceDetail() {
  $service_id = 'devel.dumper';
  // Ensures that the page works as expected.
  $this->drupalGet("/devel/container/service/{$service_id}");
  $this->assertSession()
    ->statusCodeEquals(200);
  $this->assertSession()
    ->pageTextContains("Service {$service_id} detail");
  // Ensures that the page returns a 404 error if the requested service is
  // not defined.
  $this->drupalGet('/devel/container/service/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/{$service_id}");
  $this->assertSession()
    ->statusCodeEquals(403);
}