Commit 453b2517 authored by webchick's avatar webchick
Browse files

Issue #1813832 by andypost, xjm, sun: Fixed Entity wrongly checks existence of...

Issue #1813832 by andypost, xjm, sun: Fixed Entity wrongly checks existence of ID in isNew() method.
parent f711ad88
......@@ -51,7 +51,7 @@ public function getOriginalID() {
* since each configuration entity is unique.
*/
final public function isNew() {
return !$this->id();
return $this->id() === NULL;
}
/**
......
......@@ -91,7 +91,7 @@ public function uuid() {
* Implements EntityInterface::isNew().
*/
public function isNew() {
return !empty($this->enforceIsNew) || !$this->id();
return !empty($this->enforceIsNew) || $this->id() === NULL;
}
/**
......
......@@ -85,6 +85,19 @@ function testCRUD() {
$this->assertResponse(200);
$this->assertNoText($label1);
$this->assertText($label3);
// Create a configuration entity with '0' machine name.
$edit = array(
'id' => '0',
'label' => '0',
);
$this->drupalPost('admin/structure/config_test/add', $edit, 'Save');
$this->assertResponse(200);
$message_insert = format_string('%label configuration has been created.', array('%label' => $edit['id']));
$this->assertRaw($message_insert);
$this->drupalPost('admin/structure/config_test/manage/0/delete', array(), 'Delete');
$this->assertFalse(entity_load('config_test', '0'), 'Test entity deleted');
}
}
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