You are here

public function ContentEntityViewModesExtractorTest::setUp in Acquia Content Hub 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/Normalizer/ContentEntityViewModesExtractorTest.php, line 140

Class

ContentEntityViewModesExtractorTest
PHPUnit test for the ContentEntityViewModesExtractor class.

Namespace

Drupal\Tests\acquia_contenthub\Unit\Normalizer

Code

public function setUp() : void {
  parent::setUp();
  $this->currentUser = $this
    ->createMock('Drupal\\Core\\Session\\AccountProxyInterface');
  $this->entityDisplayRepository = $this
    ->createMock('Drupal\\Core\\Entity\\EntityDisplayRepositoryInterface');
  $this->entityTypeManager = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $this->entityTypeRepository = $this
    ->createMock('Drupal\\Core\\Entity\\EntityTypeRepositoryInterface');
  $this->entityConfigStorage = $this
    ->createMock('\\Drupal\\Core\\Entity\\EntityStorageInterface');
  $this->entityTypeManager
    ->getStorage('acquia_contenthub_entity_config')
    ->willReturn($this->entityConfigStorage);
  $this->entityTypeConfig = $this
    ->createMock('Drupal\\acquia_contenthub\\ContentHubEntityTypeConfigInterface');
  $this->renderer = $this
    ->createMock('Drupal\\Core\\Render\\RendererInterface');
  $this->kernel = $this
    ->createMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
  $this->accountSwitcher = $this
    ->createMock('Drupal\\Core\\Session\\AccountSwitcherInterface');
  $this->contentEntity = $this
    ->createMock('Drupal\\Core\\Entity\\ContentEntityInterface');
  $this->contentHubSubscription = $this
    ->getMockBuilder('\\Drupal\\acquia_contenthub\\ContentHubSubscription')
    ->disableOriginalConstructor()
    ->getMock();
  $this->configFactory = $this
    ->createMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
  $this->blockManager = $this
    ->createMock('Drupal\\Core\\Block\\BlockManagerInterface');
  $config = $this
    ->getMockBuilder('Drupal\\Core\\Config\\Config')
    ->disableOriginalConstructor()
    ->getMock();
  $config
    ->expects($this
    ->once())
    ->method('get')
    ->with('user_role')
    ->willReturn(AccountInterface::ANONYMOUS_ROLE);
  $this->configFactory
    ->expects($this
    ->once())
    ->method('get')
    ->with('acquia_contenthub.entity_config')
    ->willReturn($config);
  $this->requestStack = $this
    ->getMockBuilder('Symfony\\Component\\HttpFoundation\\RequestStack')
    ->disableOriginalConstructor()
    ->getMock();
}