public function EntityFormTest::testGetEntityFromRouteMatchAdd in Drupal 9
Same name and namespace in other branches
- 8 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 159
Class
- EntityFormTest
- @coversDefaultClass \Drupal\Core\Entity\EntityForm @group Entity
Namespace
Drupal\Tests\Core\EntityCode
public function testGetEntityFromRouteMatchAdd() {
$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);
}