public function RouterTest::testControllerPlaceholders

Confirms that placeholders in paths work correctly.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Routing/RouterTest.php, line 59
Definition of Drupal\system\Tests\Routing\RouterTest.

Class

RouterTest
Functional class for the full integrated routing system.

Namespace

Drupal\system\Tests\Routing

Code

public function testControllerPlaceholders() {

  // Test with 0 and a random value.
  $values = array(
    "0",
    $this
      ->randomName(),
  );
  foreach ($values as $value) {
    $this
      ->drupalGet('router_test/test3/' . $value);
    $this
      ->assertResponse(200);
    $this
      ->assertRaw($value, 'The correct string was returned because the route was successful.');
  }

  // Confirm that the page wrapping is being added, so we're not getting a
  // raw body returned.
  $this
    ->assertRaw('</html>', 'Page markup was found.');

  // In some instances, the subrequest handling may get confused and render
  // a page inception style.  This test verifies that is not happening.
  $this
    ->assertNoPattern('#</body>.*</body>#s', 'There was no double-page effect from a misrendered subrequest.');
}