You are here

public function ContentEntityViewModesExtractorTest::testGetRenderedViewModesConfiguredNotToBeRendered in Acquia Content Hub 8

Test the getRenderedViewModes method, configured not to be rendered.

@covers ::getRenderedViewModes

File

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

Class

ContentEntityViewModesExtractorTest
PHPUnit test for the ContentEntityViewModesExtractor class.

Namespace

Drupal\Tests\acquia_contenthub\Unit\Normalizer

Code

public function testGetRenderedViewModesConfiguredNotToBeRendered() {
  $this->contentEntity
    ->expects($this
    ->once())
    ->method('getEntityTypeId')
    ->willReturn('entity_type_1');
  $this->contentEntity
    ->expects($this
    ->once())
    ->method('bundle')
    ->willReturn('bundle_1');
  $this->contentEntity
    ->expects($this
    ->any())
    ->method('isNew')
    ->willReturn(FALSE);
  $this->entityConfigStorage
    ->expects($this
    ->once())
    ->method('loadMultiple')
    ->with([
    'entity_type_1',
  ])
    ->willReturn([]);
  $contentEntityViewModesExtractor = new ContentEntityViewModesExtractor($this->currentUser, $this->entityDisplayRepository, $this->entityTypeManager
    ->reveal(), $this->renderer, $this->kernel, $this->accountSwitcher, $this->contentHubSubscription, $this->configFactory, $this->blockManager, $this->requestStack);
  $rendered_view_modes = $contentEntityViewModesExtractor
    ->getRenderedViewModes($this->contentEntity);
  $this
    ->assertNull($rendered_view_modes);
}