function EntityFormTest::testGetEntityFromRouteMatchEditDelete

Same name and namespace in other branches
  1. 10 core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php \Drupal\Tests\Core\Entity\EntityFormTest::testGetEntityFromRouteMatchEditDelete()
  2. 9 core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php \Drupal\Tests\Core\Entity\EntityFormTest::testGetEntityFromRouteMatchEditDelete()
  3. 8.9.x core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php \Drupal\Tests\Core\Entity\EntityFormTest::testGetEntityFromRouteMatchEditDelete()

Tests EntityForm::getEntityFromRouteMatch() for edit and delete forms.

@legacy-covers ::getEntityFromRouteMatch

File

core/tests/Drupal/Tests/Core/Entity/EntityFormTest.php, line 162

Class

EntityFormTest
Tests Drupal\Core\Entity\EntityForm.

Namespace

Drupal\Tests\Core\Entity

Code

public function testGetEntityFromRouteMatchEditDelete() : void {
  $entity = $this->prophesize(EntityInterface::class)
    ->reveal();
  $id = $this->entityType
    ->id();
  $route_match = new RouteMatch('test_route', new Route('/entity-test/manage/{' . $id . '}/edit'), [
    $id => $entity,
  ], [
    $id => 1,
  ]);
  $actual = $this->entityForm
    ->getEntityFromRouteMatch($route_match, $id);
  $this->assertEquals($entity, $actual);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.