public function EntityAdapterUnitTest::testGetString in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php \Drupal\Tests\Core\Entity\TypedData\EntityAdapterUnitTest::testGetString()
@covers ::getString
File
- core/
tests/ Drupal/ Tests/ Core/ Entity/ TypedData/ EntityAdapterUnitTest.php, line 386 - Contains \Drupal\Tests\Core\Entity\TypedData\EntityAdapterUnitTest.
Class
- EntityAdapterUnitTest
- @coversDefaultClass \Drupal\Core\Entity\Plugin\DataType\EntityAdapter @group Entity @group TypedData
Namespace
Drupal\Tests\Core\Entity\TypedDataCode
public function testGetString() {
$entity = $this
->getMock('\\Drupal\\Core\\Entity\\ContentEntityInterface');
$entity
->expects($this
->once())
->method('label')
->willReturn('foo');
$this->entityAdapter
->setValue($entity);
$this
->assertEquals('foo', $this->entityAdapter
->getString());
$this->entityAdapter
->setValue(NULL);
$this
->assertEquals('', $this->entityAdapter
->getString());
}