Skip to content
Permalink
Browse files

adds a unit test for PHP serializing of Entity object

  • Loading branch information...
thinkingmedia
thinkingmedia committed Jan 29, 2017
1 parent 82d45df commit da160811d2bdb0a51ae2316b77b1f3489269b8ec
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/TestCase/ORM/EntityTest.php
@@ -712,6 +712,20 @@ public function testJsonSerialize()
$this->assertEquals(json_encode($data), json_encode($entity));
}
/**
* Tests serializing an entity as PHP
*
* @return void
*/
public function testPhpSerialize()
{
$data = ['name' => 'James', 'age' => 20, 'phones' => ['123', '457']];
$entity = new Entity($data);
$copy = unserialize(serialize($entity));
$this->assertInstanceOf(Entity::class, $copy);
$this->assertEquals($data, $copy->toArray());
}
/**
* Tests that jsonSerialize is called recursively for contained entities
*

0 comments on commit da16081

Please sign in to comment.
You can’t perform that action at this time.