Alcaeus\MongoDbAdapter\Tests\Mongo\MongoIdTest::testCreateWithoutParameter PHP Method

testCreateWithoutParameter() public method

    public function testCreateWithoutParameter()
    {
        $id = new \MongoId();
        $stringId = (string) $id;
        $this->assertSame(24, strlen($stringId));
        $this->assertSame($stringId, $id->{'$id'});
        $serialized = serialize($id);
        $this->assertSame(sprintf('C:7:"MongoId":24:{%s}', $stringId), $serialized);
        $unserialized = unserialize($serialized);
        $this->assertInstanceOf('MongoId', $unserialized);
        $this->assertSame($stringId, (string) $unserialized);
        $json = json_encode($id);
        $this->assertSame(sprintf('{"$id":"%s"}', $stringId), $json);
    }