Skip to content

Commit

Permalink
adds a unit test for PHP serializing of Entity object
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingmedia committed Jan 29, 2017
1 parent 82d45df commit da16081
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/TestCase/ORM/EntityTest.php
Expand Up @@ -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
*
Expand Down

0 comments on commit da16081

Please sign in to comment.