-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* Part of JsonMapper | ||
* | ||
* PHP version 5 | ||
* | ||
* @category Tools | ||
* @package JsonMapper | ||
* @author Christian Weiske <[email protected]> | ||
* @license OSL-3.0 http://opensource.org/licenses/osl-3.0 | ||
* @link https://github.com/cweiske/jsonmapper | ||
*/ | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
require_once 'JsonMapperTest/EventObject.php'; | ||
|
||
/** | ||
* Unit tests for JsonMapper's object handling (events) | ||
* | ||
* @category Tools | ||
* @package JsonMapper | ||
* @author Christian Weiske <[email protected]> | ||
* @license OSL-3.0 http://opensource.org/licenses/osl-3.0 | ||
* @link https://github.com/cweiske/jsonmapper | ||
*/ | ||
class EventTest extends TestCase | ||
{ | ||
/** | ||
* Test for deserialize post event | ||
* | ||
* @throws \JsonMapper_Exception | ||
*/ | ||
public function testDeserializePostEvent() | ||
{ | ||
$jm = new JsonMapper(); | ||
$jm->postMappingMethodName = '_deserializePostEvent'; | ||
/** @var JsonMapperTest_EventObject $sn */ | ||
$sn = $jm->map( | ||
json_decode('{"pStr":"one"}', false), | ||
new JsonMapperTest_EventObject() | ||
); | ||
$this->assertIsString($sn->pStr); | ||
$this->assertEquals('two', $sn->pStr); | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
class JsonMapperTest_EventObject | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
public $pStr; | ||
|
||
private function _deserializePostEvent(){ | ||
$this->pStr = 'two'; | ||
} | ||
} | ||
?> |