public function __toString()
{
if (empty($this->authors)) {
return '';
}
$authorNames = array();
if ($this->authors instanceof AuthorCollection) {
foreach ($this->authors as $author) {
$authorNames[] = $author->name;
}
}
return implode(', ', $authorNames);
}
/** * @covers \eZ\Publish\Core\FieldType\Author\Value::__toString */ public function testFieldValueToString() { $value = new AuthorValue($this->authors); $authorsName = array(); foreach ($this->authors as $author) { $authorsName[] = $author->name; } self::assertSame(implode(', ', $authorsName), $value->__toString()); }