diff -u b/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php --- b/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -261,7 +261,7 @@ * {@inheritdoc} */ public function getString() { - return $this->label(); + return (string) $this->label(); } /** diff -u b/core/lib/Drupal/Core/Entity/Entity.php b/core/lib/Drupal/Core/Entity/Entity.php --- b/core/lib/Drupal/Core/Entity/Entity.php +++ b/core/lib/Drupal/Core/Entity/Entity.php @@ -38,13 +38,6 @@ protected $uuidGenerator; /** - * The entity info used for testing.. - * - * @var \Drupal\Core\Entity\EntityTypeInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $entityInfo; - - /** * The entity type. * * @var string diff -u b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php --- b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/EntityUnitTest.php @@ -38,11 +38,11 @@ protected $entityManager; /** - * The type of the entity under test. + * The ID of the type of the entity under test. * * @var string */ - protected $entityType; + protected $entityTypeId; /** * The route provider used for testing. @@ -74,14 +74,14 @@ */ public function setUp() { $values = array(); - $this->entityType = $this->randomName(); + $this->entityTypeId = $this->randomName(); $this->entityInfo = $this->getMock('\Drupal\Core\Entity\EntityTypeInterface'); $this->entityManager = $this->getMock('\Drupal\Core\Entity\EntityManagerInterface'); $this->entityManager->expects($this->any()) ->method('getDefinition') - ->with($this->entityType) + ->with($this->entityTypeId) ->will($this->returnValue($this->entityInfo)); $this->routeProvider = $this->getMockBuilder('\Drupal\Core\Routing\RouteProvider') @@ -91,7 +91,7 @@ $this->uuid = $this->getMock('\Drupal\Component\Uuid\UuidInterface'); $this->entity = $this->getMockBuilder('\Drupal\Core\Entity\Entity') - ->setConstructorArgs(array($values, $this->entityType)) + ->setConstructorArgs(array($values, $this->entityTypeId)) ->setMethods(array('entityManager', 'uuidGenerator', 'languageLoad', 'routeProvider')) ->getMock(); $this->entity->expects($this->any()) @@ -140,17 +140,17 @@ } /** - * @covers ::entityType + * @covers ::getEntityType */ - public function testEntityType() { - $this->assertSame($this->entityType, $this->entity->entityType()); + public function testGetEntityType() { + $this->assertInstanceOf('\Drupal\Core\Entity\EntityTypeInterface', $this->entity->getEntityType()); } /** * @covers ::bundle */ public function testBundle() { - $this->assertSame($this->entityType, $this->entity->bundle()); + $this->assertSame($this->entityTypeId, $this->entity->bundle()); } /** @@ -181,7 +181,7 @@ // be returned form a property if there is no callback. $this->entityManager->expects($this->at(1)) ->method('getDefinition') - ->with($this->entityType) + ->with($this->entityTypeId) ->will($this->returnValue(array( 'entity_keys' => array( 'label' => 'label', @@ -230,7 +230,7 @@ ->with($this->entity); $this->entityManager->expects($this->once()) ->method('getStorageController') - ->with($this->entityType) + ->with($this->entityTypeId) ->will($this->returnValue($storage)); $this->entity->save(); } @@ -246,19 +246,16 @@ ->method('delete'); $this->entityManager->expects($this->once()) ->method('getStorageController') - ->with($this->entityType) + ->with($this->entityTypeId) ->will($this->returnValue($storage)); $this->entity->delete(); } /** - * @covers ::entityInfo + * @covers ::getEntityTypeId */ - public function testEntityInfo() { - $this->entityManager->expects($this->once()) - ->method('getDefinition') - ->with($this->entityType); - $this->entity->entityInfo(); + public function testGetEntityTypeId() { + $this->assertSame($this->entityTypeId, $this->entity->getEntityTypeId()); } /**