diff --git a/src/Datasource/EntityTrait.php b/src/Datasource/EntityTrait.php index a3e9051658b..aeb5c619318 100644 --- a/src/Datasource/EntityTrait.php +++ b/src/Datasource/EntityTrait.php @@ -885,15 +885,14 @@ public function __toString() */ public function __debugInfo() { - return [ - 'new' => $this->isNew(), - 'accessible' => array_filter($this->_accessible), - 'properties' => $this->_properties, - 'dirty' => $this->_dirty, - 'original' => $this->_original, - 'virtual' => $this->_virtual, - 'errors' => $this->_errors, - 'repository' => $this->_registryAlias + return $this->_properties + [ + '[new]' => $this->isNew(), + '[accessible]' => array_filter($this->_accessible), + '[dirty]' => $this->_dirty, + '[original]' => $this->_original, + '[virtual]' => $this->_virtual, + '[errors]' => $this->_errors, + '[repository]' => $this->_registryAlias ]; } } diff --git a/tests/TestCase/ORM/EntityTest.php b/tests/TestCase/ORM/EntityTest.php index c23e7323ae4..4641fffcc86 100644 --- a/tests/TestCase/ORM/EntityTest.php +++ b/tests/TestCase/ORM/EntityTest.php @@ -1163,6 +1163,7 @@ public function testToString() public function testDebugInfo() { $entity = new Entity(['foo' => 'bar'], ['markClean' => true]); + $entity->somethingElse = 'value'; $entity->accessible('name', true); $entity->virtualProperties(['baz']); $entity->dirty('foo', true); @@ -1170,14 +1171,15 @@ public function testDebugInfo() $entity->source('foos'); $result = $entity->__debugInfo(); $expected = [ - 'new' => true, - 'accessible' => ['*' => true, 'name' => true], - 'properties' => ['foo' => 'bar'], - 'dirty' => ['foo' => true], - 'original' => [], - 'virtual' => ['baz'], - 'errors' => ['foo' => ['An error']], - 'repository' => 'foos' + 'foo' => 'bar', + 'somethingElse' => 'value', + '[new]' => true, + '[accessible]' => ['*' => true, 'name' => true], + '[dirty]' => ['somethingElse' => true, 'foo' => true], + '[original]' => [], + '[virtual]' => ['baz'], + '[errors]' => ['foo' => ['An error']], + '[repository]' => 'foos' ]; $this->assertSame($expected, $result); }