protected function ConfigEntityBaseUnitTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityBaseUnitTest.php, line 94 - Contains \Drupal\Tests\Core\Config\Entity\ConfigEntityBaseUnitTest.
Class
- ConfigEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
protected function setUp() {
$this->id = $this
->randomMachineName();
$values = array(
'id' => $this->id,
'langcode' => 'en',
'uuid' => '3bb9ee60-bea5-4622-b89b-a63319d10b3a',
);
$this->entityTypeId = $this
->randomMachineName();
$this->provider = $this
->randomMachineName();
$this->entityType = $this
->getMock('\\Drupal\\Core\\Config\\Entity\\ConfigEntityTypeInterface');
$this->entityType
->expects($this
->any())
->method('getProvider')
->will($this
->returnValue($this->provider));
$this->entityType
->expects($this
->any())
->method('getConfigPrefix')
->willReturn('test_provider.' . $this->entityTypeId);
$this->entityManager = $this
->getMock('\\Drupal\\Core\\Entity\\EntityManagerInterface');
$this->entityManager
->expects($this
->any())
->method('getDefinition')
->with($this->entityTypeId)
->will($this
->returnValue($this->entityType));
$this->uuid = $this
->getMock('\\Drupal\\Component\\Uuid\\UuidInterface');
$this->languageManager = $this
->getMock('\\Drupal\\Core\\Language\\LanguageManagerInterface');
$this->languageManager
->expects($this
->any())
->method('getLanguage')
->with('en')
->will($this
->returnValue(new Language(array(
'id' => 'en',
))));
$this->cacheTagsInvalidator = $this
->getMock('Drupal\\Core\\Cache\\CacheTagsInvalidatorInterface');
$this->typedConfigManager = $this
->getMock('Drupal\\Core\\Config\\TypedConfigManagerInterface');
$container = new ContainerBuilder();
$container
->set('entity.manager', $this->entityManager);
$container
->set('uuid', $this->uuid);
$container
->set('language_manager', $this->languageManager);
$container
->set('cache_tags.invalidator', $this->cacheTagsInvalidator);
$container
->set('config.typed', $this->typedConfigManager);
\Drupal::setContainer($container);
$this->entity = $this
->getMockForAbstractClass('\\Drupal\\Core\\Config\\Entity\\ConfigEntityBase', array(
$values,
$this->entityTypeId,
));
}