function UpcastingTest::testSameTypes
Same name in other branches
- 8.9.x core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php \Drupal\Tests\system\Functional\ParamConverter\UpcastingTest::testSameTypes()
- 10 core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php \Drupal\Tests\system\Functional\ParamConverter\UpcastingTest::testSameTypes()
- 11.x core/modules/system/tests/src/Functional/ParamConverter/UpcastingTest.php \Drupal\Tests\system\Functional\ParamConverter\UpcastingTest::testSameTypes()
Confirms we can upcast to controller arguments of the same type.
File
-
core/
modules/ system/ tests/ src/ Functional/ ParamConverter/ UpcastingTest.php, line 58
Class
- UpcastingTest
- Tests upcasting of URL arguments to entities.
Namespace
Drupal\Tests\system\Functional\ParamConverterCode
public function testSameTypes() {
$node = $this->drupalCreateNode([
'title' => $this->randomMachineName(8),
]);
$parent = $this->drupalCreateNode([
'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->assertSession()
->pageTextContains("Setting '" . $parent->getTitle() . "' as parent of '" . $node->getTitle() . "'.");
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.