3 namespace Drupal\Tests\Core\Entity;
5 use Drupal\Component\Datetime\TimeInterface;
6 use Drupal\Core\Entity\ContentEntityForm;
7 use Drupal\Core\Entity\EntityManagerInterface;
8 use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
9 use Drupal\Tests\UnitTestCase;
12 * @coversDefaultClass \Drupal\Core\Entity\ContentEntityForm
15 class ContentEntityFormTest extends UnitTestCase {
19 * @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.
21 public function testEntityManagerDeprecation() {
22 $entity_manager = $this->prophesize(EntityManagerInterface::class)->reveal();
23 $entity_type_bundle_info = $this->prophesize(EntityTypeBundleInfoInterface::class)->reveal();
24 $time = $this->prophesize(TimeInterface::class)->reveal();
25 $form = new ContentEntityForm($entity_manager, $entity_type_bundle_info, $time);
27 $reflected_form = new \ReflectionClass($form);
28 $entity_manager_property = $reflected_form->getProperty('entityManager');
29 $entity_manager_property->setAccessible(TRUE);
30 $this->assertTrue($entity_manager_property->getValue($form) === $entity_manager);