class EntityManagerTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Entity/EntityManagerTest.php \Drupal\Tests\Core\Entity\EntityManagerTest
@coversDefaultClass \Drupal\Core\Entity\EntityManager @group Entity
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\Core\Entity\EntityManagerTest
Expanded class hierarchy of EntityManagerTest
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ EntityManagerTest.php, line 23 - Contains \Drupal\Tests\Core\Entity\EntityManagerTest.
Namespace
Drupal\Tests\Core\EntityView source
class EntityManagerTest extends UnitTestCase {
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManager
*/
protected $entityManager;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface|\Prophecy\Prophecy\ProphecyInterface
*/
protected $entityTypeManager;
/**
* The entity type repository.
*
* @var \Drupal\Core\Entity\EntityTypeRepositoryInterface|\Prophecy\Prophecy\ProphecyInterface
*/
protected $entityTypeRepository;
/**
* The entity type bundle info.
*
* @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface|\Prophecy\Prophecy\ProphecyInterface
*/
protected $entityTypeBundleInfo;
/**
* The entity field manager.
*
* @var \Drupal\Core\Entity\EntityFieldManagerInterface|\Prophecy\Prophecy\ProphecyInterface
*/
protected $entityFieldManager;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->entityTypeManager = $this
->prophesize(EntityTypeManagerInterface::class);
$this->entityTypeRepository = $this
->prophesize(EntityTypeRepositoryInterface::class);
$this->entityTypeBundleInfo = $this
->prophesize(EntityTypeBundleInfoInterface::class);
$this->entityFieldManager = $this
->prophesize(EntityFieldManagerInterface::class);
$container = new ContainerBuilder();
$container
->set('entity_type.manager', $this->entityTypeManager
->reveal());
$container
->set('entity_type.repository', $this->entityTypeRepository
->reveal());
$container
->set('entity_type.bundle.info', $this->entityTypeBundleInfo
->reveal());
$container
->set('entity_field.manager', $this->entityFieldManager
->reveal());
$this->entityManager = new EntityManager();
$this->entityManager
->setContainer($container);
}
/**
* Tests the clearCachedDefinitions() method.
*
* @covers ::clearCachedDefinitions
*/
public function testClearCachedDefinitions() {
$this->entityTypeManager
->clearCachedDefinitions()
->shouldBeCalled();
$this->entityTypeRepository
->clearCachedDefinitions()
->shouldBeCalled();
$this->entityTypeBundleInfo
->clearCachedBundles()
->shouldBeCalled();
$this->entityFieldManager
->clearCachedFieldDefinitions()
->shouldBeCalled();
$this->entityManager
->clearCachedDefinitions();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityManagerTest:: |
protected | property | The entity field manager. | |
EntityManagerTest:: |
protected | property | The entity manager. | |
EntityManagerTest:: |
protected | property | The entity type bundle info. | |
EntityManagerTest:: |
protected | property | The entity type manager. | |
EntityManagerTest:: |
protected | property | The entity type repository. | |
EntityManagerTest:: |
protected | function |
Overrides UnitTestCase:: |
|
EntityManagerTest:: |
public | function | Tests the clearCachedDefinitions() method. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |