protected function ConfigSnapshotConfigEntityUnitTest::setUp in Config Snapshot 8
Overrides UnitTestCase::setUp
File
- tests/
src/ Unit/ ConfigSnapshotConfigEntityUnitTest.php, line 63
Class
- ConfigSnapshotConfigEntityUnitTest
- @coversDefaultClass \Drupal\config_snapshot\Entity\ConfigSnapshot @group config_snapshot
Namespace
Drupal\Tests\config_snapshot\UnitCode
protected function setUp() {
$this->entityType = $this
->createMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
$this->entityType
->expects($this
->any())
->method('getProvider')
->will($this
->returnValue('entity'));
$this->entityManager = new EntityManager();
$this->entityTypeManager = $this
->createMock(EntityTypeManagerInterface::class);
$this->uuid = $this
->createMock('\\Drupal\\Component\\Uuid\\UuidInterface');
$container = new ContainerBuilder();
$container
->set('entity.manager', $this->entityManager);
$container
->set('entity_type.manager', $this->entityTypeManager);
$container
->set('uuid', $this->uuid);
$this->entityManager
->setContainer($container);
\Drupal::setContainer($container);
$snapshot_set = $this
->randomMachineName(8);
$extension_type = 'module';
$this->extensionName = $this
->randomMachineName(8);
$values = [
'snapshotSet' => $snapshot_set,
'extensionType' => $extension_type,
'extensionName' => $this->extensionName,
];
$this->entity = new ConfigSnapshot($values, 'config_snapshot.snapshot');
}