Commit 5a58ba9f authored by alexpott's avatar alexpott

Issue #2449709 by banviktor: ContentEntityBase::set() does not respect its interface

parent 48f6e295
......@@ -409,6 +409,7 @@ public function set($name, $value, $notify = TRUE) {
// notified to handle changes afterwards. We can ignore notify as there is
// no parent to notify anyway.
$this->get($name)->setValue($value, TRUE);
return $this;
}
/**
......
......@@ -166,6 +166,9 @@ protected function setUp() {
$this->fieldTypePluginManager->expects($this->any())
->method('getDefaultFieldSettings')
->will($this->returnValue(array()));
$this->fieldTypePluginManager->expects($this->any())
->method('createFieldItemList')
->will($this->returnValue($this->getMock('Drupal\Core\Field\FieldItemListInterface')));
$container = new ContainerBuilder();
$container->set('entity.manager', $this->entityManager);
......@@ -536,4 +539,15 @@ public function testGetFields($expected, $include_computed, $is_computed, $field
);
}
/**
* @covers ::set
*/
public function testSet() {
// Exercise set(), check if it returns $this
$this->assertSame(
$this->entity,
$this->entity->set('id', 0)
);
}
}
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