You are here

public function EntityDisplayModeBaseUnitTest::testCalculateDependencies in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\EntityDisplayModeBaseUnitTest::testCalculateDependencies()

@covers ::calculateDependencies

File

core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php, line 78
Contains \Drupal\Tests\Core\Config\Entity\EntityDisplayModeBaseUnitTest.

Class

EntityDisplayModeBaseUnitTest
@coversDefaultClass \Drupal\Core\Entity\EntityDisplayModeBase @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testCalculateDependencies() {
  $target_entity_type_id = $this
    ->randomMachineName(16);
  $target_entity_type = $this
    ->getMock('\\Drupal\\Core\\Entity\\EntityTypeInterface');
  $target_entity_type
    ->expects($this
    ->any())
    ->method('getProvider')
    ->will($this
    ->returnValue('test_module'));
  $values = array(
    'targetEntityType' => $target_entity_type_id,
  );
  $this->entityManager
    ->expects($this
    ->at(0))
    ->method('getDefinition')
    ->with($target_entity_type_id)
    ->will($this
    ->returnValue($target_entity_type));
  $this->entityManager
    ->expects($this
    ->at(1))
    ->method('getDefinition')
    ->with($this->entityType)
    ->will($this
    ->returnValue($this->entityInfo));
  $this->entity = $this
    ->getMockBuilder('\\Drupal\\Core\\Entity\\EntityDisplayModeBase')
    ->setConstructorArgs(array(
    $values,
    $this->entityType,
  ))
    ->setMethods(array(
    'getFilterFormat',
  ))
    ->getMock();
  $dependencies = $this->entity
    ->calculateDependencies()
    ->getDependencies();
  $this
    ->assertContains('test_module', $dependencies['module']);
}