You are here

public function UpcastingTest::testSameTypes in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/ParamConverter/UpcastingTest.php \Drupal\system\Tests\ParamConverter\UpcastingTest::testSameTypes()

Confirms we can upcast to controller arguments of the same type.

File

core/modules/system/src/Tests/ParamConverter/UpcastingTest.php, line 55
Contains \Drupal\system\Tests\ParamConverter\UpcastingTest.

Class

UpcastingTest
Tests upcasting of url arguments to entities.

Namespace

Drupal\system\Tests\ParamConverter

Code

public function testSameTypes() {
  $node = $this
    ->drupalCreateNode(array(
    'title' => $this
      ->randomMachineName(8),
  ));
  $parent = $this
    ->drupalCreateNode(array(
    'title' => $this
      ->randomMachineName(8),
  ));

  // paramconverter_test/node/{node}/set/parent/{parent}
  // options.parameters.parent.type = entity:node
  $this
    ->drupalGet("paramconverter_test/node/" . $node
    ->id() . "/set/parent/" . $parent
    ->id());
  $this
    ->assertRaw("Setting '" . $parent
    ->getTitle() . "' as parent of '" . $node
    ->getTitle() . "'.");
}