View source
<?php
namespace Drupal\Tests\Core\Config\Entity;
use Drupal\Tests\UnitTestCase;
class EntityDisplayBaseTest extends UnitTestCase {
public function testGetTargetEntityTypeId() {
$mock = $this
->getMockForAbstractClass('\\Drupal\\Core\\Entity\\EntityDisplayBase', [], '', FALSE);
$reflection = new \ReflectionProperty($mock, 'targetEntityType');
$reflection
->setAccessible(TRUE);
$reflection
->setValue($mock, 'test');
$this
->assertEquals('test', $mock
->getTargetEntityTypeId());
}
public function testGetMode() {
$mock = $this
->getMockForAbstractClass('\\Drupal\\Core\\Entity\\EntityDisplayBase', [], '', FALSE);
$reflection = new \ReflectionProperty($mock, 'mode');
$reflection
->setAccessible(TRUE);
$reflection
->setValue($mock, 'test');
$this
->assertEquals('test', $mock
->getMode());
}
public function testGetOriginalMode() {
$mock = $this
->getMockForAbstractClass('\\Drupal\\Core\\Entity\\EntityDisplayBase', [], '', FALSE);
$reflection = new \ReflectionProperty($mock, 'originalMode');
$reflection
->setAccessible(TRUE);
$reflection
->setValue($mock, 'test');
$this
->assertEquals('test', $mock
->getOriginalMode());
}
public function testGetTargetBundle() {
$mock = $this
->getMockForAbstractClass('\\Drupal\\Core\\Entity\\EntityDisplayBase', [], '', FALSE);
$reflection = new \ReflectionProperty($mock, 'bundle');
$reflection
->setAccessible(TRUE);
$reflection
->setValue($mock, 'test');
$this
->assertEquals('test', $mock
->getTargetBundle());
}
public function testSetTargetBundle() {
$mock = $this
->getMockForAbstractClass('\\Drupal\\Core\\Entity\\EntityDisplayBase', [], '', FALSE);
$reflection = new \ReflectionProperty($mock, 'bundle');
$reflection
->setAccessible(TRUE);
$mock
->setTargetBundle('test');
$this
->assertEquals('test', $reflection
->getValue($mock));
}
}