public function ContentEntityBaseUnitTest::testLabel in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest::testLabel()
@covers ::label
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ ContentEntityBaseUnitTest.php, line 450 - Contains \Drupal\Tests\Core\Entity\ContentEntityBaseUnitTest.
Class
- ContentEntityBaseUnitTest
- @coversDefaultClass \Drupal\Core\Entity\ContentEntityBase @group Entity @group Access
Namespace
Drupal\Tests\Core\EntityCode
public function testLabel() {
// Make a mock with one method that we use as the entity's label callback.
// We check that it is called, and that the entity's label is the callback's
// return value.
$callback_label = $this
->randomMachineName();
$callback_container = $this
->getMock(get_class());
$callback_container
->expects($this
->once())
->method(__FUNCTION__)
->will($this
->returnValue($callback_label));
$this->entityType
->expects($this
->once())
->method('getLabelCallback')
->will($this
->returnValue(array(
$callback_container,
__FUNCTION__,
)));
$this
->assertSame($callback_label, $this->entity
->label());
}