66a59788c26889e8228c776fdc2fce64c9a73398
[yaffs-website] / web / core / tests / Drupal / Tests / Core / Entity / ContentEntityFormTest.php
1 <?php
2
3 namespace Drupal\Tests\Core\Entity;
4
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;
10
11 /**
12  * @coversDefaultClass \Drupal\Core\Entity\ContentEntityForm
13  * @group Entity
14  */
15 class ContentEntityFormTest extends UnitTestCase {
16
17   /**
18    * @group legacy
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.
20    */
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);
26
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);
31   }
32
33 }