public function EntityDisplayModeBaseUnitTest::testGetTargetType in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Config/Entity/EntityDisplayModeBaseUnitTest.php \Drupal\Tests\Core\Config\Entity\EntityDisplayModeBaseUnitTest::testGetTargetType()
@covers ::getTargetType
File
- core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ EntityDisplayModeBaseUnitTest.php, line 137 - Contains \Drupal\Tests\Core\Config\Entity\EntityDisplayModeBaseUnitTest.
Class
- EntityDisplayModeBaseUnitTest
- @coversDefaultClass \Drupal\Core\Entity\EntityDisplayModeBase @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testGetTargetType() {
// Generate mock.
$mock = $this
->getMock('Drupal\\Core\\Entity\\EntityDisplayModeBase', NULL, array(
array(
'something' => 'nothing',
),
'test_type',
));
// A test value.
$target = 'test_target_type';
// Gain access to the protected property.
$property = new \ReflectionProperty($mock, 'targetEntityType');
$property
->setAccessible(TRUE);
// Set the property to a known state.
$property
->setValue($mock, $target);
// Get the target type.
$value = $mock
->getTargetType($target);
// Test the outcome.
$this
->assertEquals($value, $property
->getValue($mock));
}