function EntityFormTest::testGetEntityFromRouteMatchAdd
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php \Drupal\Tests\Core\Entity\EntityFormTest::testGetEntityFromRouteMatchAdd()
- 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php \Drupal\Tests\Core\Entity\EntityFormTest::testGetEntityFromRouteMatchAdd()
- 10 core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php \Drupal\Tests\Core\Entity\EntityFormTest::testGetEntityFromRouteMatchAdd()
Tests EntityForm::getEntityFromRouteMatch() for add forms without a bundle.
@covers ::getEntityFromRouteMatch
File
-
core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityFormTest.php, line 171
Class
- EntityFormTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21EntityForm.php/class/EntityForm/11.x" title="Base class for entity forms." class="local">\Drupal\Core\Entity\EntityForm</a> @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetEntityFromRouteMatchAdd() : void {
$entity = $this->prophesize(EntityInterface::class)
->reveal();
$this->setUpStorage()
->create([])
->willReturn($entity);
$route_match = new RouteMatch('test_route', new Route('/entity-test/add'));
$actual = $this->entityForm
->getEntityFromRouteMatch($route_match, $this->entityType
->id());
$this->assertEquals($entity, $actual);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.