Commit f8673ac4 authored by Dries's avatar Dries

Issue #1813832 by andypost: Fixed Allow use '0' as id for entity.

parent d3edf501
......@@ -51,7 +51,8 @@ public function getOriginalID() {
* since each configuration entity is unique.
*/
final public function isNew() {
return !$this->id();
$id = $this->id();
return !isset($id);
}
/**
......
......@@ -91,7 +91,8 @@ public function uuid() {
* Implements EntityInterface::isNew().
*/
public function isNew() {
return !empty($this->enforceIsNew) || !$this->id();
$id = $this->id();
return !empty($this->enforceIsNew) || !isset($id);
}
/**
......
......@@ -78,13 +78,16 @@ function testCRUD() {
// Rename the configuration entity's ID/machine name.
$this->assertLinkByHref('admin/structure/config_test/manage/' . $id);
$edit = array(
'id' => strtolower($this->randomName()),
'id' => '0',
'label' => $label3,
);
$this->drupalPost('admin/structure/config_test/manage/' . $id, $edit, 'Save');
$this->assertResponse(200);
$this->assertNoText($label1);
$this->assertText($label3);
$this->drupalPost('admin/structure/config_test/manage/0/delete', array(), 'Delete');
$this->assertResponse(200);
$this->assertNoText($label3);
}
}
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