function EntityCreateAccessCustomCidTest::setUp

Overrides UnitTestCase::setUp

File

core/tests/Drupal/Tests/Core/Entity/Access/EntityCreateAccessCustomCidTest.php, line 58

Class

EntityCreateAccessCustomCidTest
Tests entity access control handler custom internal cache ID.

Namespace

Drupal\Tests\Core\Entity\Access

Code

protected function setUp() : void {
  parent::setUp();
  $this->entityType = $this->getMockBuilder(EntityTypeInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->entityType
    ->expects($this->any())
    ->method('id')
    ->willReturn($this->randomMachineName());
  $this->account = $this->getMockBuilder(AccountInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $this->account
    ->expects($this->any())
    ->method('id')
    ->willReturn(rand());
  $language_ids = array_keys(LanguageManager::getStandardLanguageList());
  $this->langcode = $language_ids[array_rand($language_ids)];
  $this->moduleHandler = $this->createMock(ModuleHandlerInterface::class);
  $this->moduleHandler
    ->expects($this->any())
    ->method('invokeAll')
    ->willReturn([]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.