Completed
Push — develop ( b85182...537c08 )
by Narcotic
02:54
created

JsonSerializerTest::testMongoHandling()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
/**
3
 * test our jsonserializer extension
4
 */
5
6
namespace Graviton\ImportExportTest\Util;
7
8
use Graviton\ImportExport\Util\JsonSerializer;
9
10
/**
11
 * @author   List of contributors <https://github.com/libgraviton/import-export/graphs/contributors>
12
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
13
 * @link     http://swisscom.ch
14
 */
15
class JsonSerializerTest extends \PHPUnit_Framework_TestCase
16
{
17
18
    /**
19
     * see if mongoid/mongodate can be properly unserialized again..
20
     *
21
     * @return void
22
     */
23
    public function testMongoHandling()
24
    {
25
        $origClass = new \stdClass();
26
        $origClass->id = 'Class';
27
        $origClass->mongoId = new \MongoId('5a5e05679ca9b2108b5e2ac9');
28
        $origClass->mongoDate = new \MongoDate();
29
30
        $serializer = new JsonSerializer();
31
        $serialized = $serializer->serialize($origClass);
32
        $class = $serializer->unserialize($serialized);
33
34
        $this->assertEquals($origClass, $class);
35
    }
36
}
37