function ContentEntityFormTest::testEntityManagerDeprecation

Tests the constructor bc layer for injecting the entity manager.

@group legacy @expectedDeprecation Passing the entity.manager service to ContentEntityForm::__construct() is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0. Pass the entity.repository service instead. See https://www.drupal.org/node/2549139. @expectedDeprecation EntityForm::entityManager is deprecated in drupal:8.0.0 and is removed from drupal:9.0.0. Use EntityForm::entityTypeManager instead. See https://www.drupal.org/node/2549139

File

core/tests/Drupal/Tests/Core/Entity/ContentEntityFormTest.php, line 24

Class

ContentEntityFormTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Entity%21ContentEntityForm.php/class/ContentEntityForm/8.9.x" title="Entity form variant for content entity types." class="local">\Drupal\Core\Entity\ContentEntityForm</a> @group Entity

Namespace

Drupal\Tests\Core\Entity

Code

public function testEntityManagerDeprecation() {
    $entity_manager = $this->prophesize(EntityManagerInterface::class)
        ->reveal();
    $entity_type_bundle_info = $this->prophesize(EntityTypeBundleInfoInterface::class)
        ->reveal();
    $time = $this->prophesize(TimeInterface::class)
        ->reveal();
    $form = new ContentEntityForm($entity_manager, $entity_type_bundle_info, $time);
    $this->assertSame($form->entityManager, $entity_manager);
}

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