Commit 63e73e9c authored by alexpott's avatar alexpott

Issue #2835588 by amateescu, Berdir: Restore EntityTestRev's behavior to not...

Issue #2835588 by amateescu, Berdir: Restore EntityTestRev's behavior to not implement RevisionLogInterface
parent e313a51e
......@@ -78,7 +78,7 @@ protected function prepareEntity() {
parent::prepareEntity();
// Hide the current revision log message in UI.
if ($this->showRevisionUi() && !$this->entity->isNew()) {
if ($this->showRevisionUi() && !$this->entity->isNew() && $this->entity instanceof RevisionLogInterface) {
$this->entity->setRevisionLogMessage(NULL);
}
}
......
......@@ -29,7 +29,7 @@ class EntitySerializationTest extends NormalizerTestBase {
/**
* The test entity.
*
* @var \Drupal\Core\Entity\ContentEntityInterface|\Drupal\Core\Entity\RevisionLogInterface
* @var \Drupal\Core\Entity\ContentEntityInterface
*/
protected $entity;
......@@ -76,10 +76,6 @@ protected function setUp() {
'value' => $this->randomMachineName(),
'format' => 'full_html',
),
'revision_log_message' => array(
'value' => 'Serialization revision message',
),
'revision_user' => $this->user->id(),
);
$this->entity = EntityTestMulRev::create($this->values);
$this->entity->save();
......@@ -127,20 +123,6 @@ public function testNormalize() {
array('value' => TRUE),
),
'non_rev_field' => array(),
'revision_created' => array(
array('value' => $this->entity->getRevisionCreationTime()),
),
'revision_user' => array(
array(
'target_id' => $this->user->id(),
'target_type' => $this->user->getEntityTypeId(),
'target_uuid' => $this->user->uuid(),
'url' => $this->user->url(),
),
),
'revision_log_message' => array(
array('value' => $this->values['revision_log_message']['value']),
),
'field_test_text' => array(
array(
'value' => $this->values['field_test_text']['value'],
......@@ -210,9 +192,6 @@ public function testSerialize() {
'revision_id' => '<revision_id><value>' . $this->entity->getRevisionId() . '</value></revision_id>',
'default_langcode' => '<default_langcode><value>1</value></default_langcode>',
'non_rev_field' => '<non_rev_field/>',
'revision_created' => '<revision_created><value>' . $this->entity->getRevisionCreationTime() . '</value></revision_created>',
'revision_user' => '<revision_user><target_id>' . $this->user->id() . '</target_id><target_type>' . $this->user->getEntityTypeId() . '</target_type><target_uuid>' . $this->user->uuid() . '</target_uuid><url>' . $this->user->url() . '</url></revision_user>',
'revision_log_message' => '<revision_log_message><value>' . $this->values['revision_log_message']['value'] . '</value></revision_log_message>',
'field_test_text' => '<field_test_text><value>' . $this->values['field_test_text']['value'] . '</value><format>' . $this->values['field_test_text']['format'] . '</format></field_test_text>',
);
// Sort it in the same order as normalised.
......
......@@ -3,8 +3,6 @@
namespace Drupal\entity_test\Entity;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\RevisionLogEntityTrait;
use Drupal\Core\Entity\RevisionLogInterface;
use Drupal\Core\Field\BaseFieldDefinition;
/**
......@@ -48,9 +46,7 @@
* }
* )
*/
class EntityTestRev extends EntityTest implements RevisionLogInterface {
use RevisionLogEntityTrait;
class EntityTestRev extends EntityTest {
/**
* {@inheritdoc}
......@@ -58,8 +54,6 @@ class EntityTestRev extends EntityTest implements RevisionLogInterface {
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields = parent::baseFieldDefinitions($entity_type);
$fields += static::revisionLogBaseFieldDefinitions($entity_type);
$fields['name']->setRevisionable(TRUE);
$fields['user_id']->setRevisionable(TRUE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment