Jsor\Doctrine\PostGIS\Functions\ST_GeogFromWKBTest::testQuery1 PHP Method

testQuery1() public method

public testQuery1 ( )
    public function testQuery1()
    {
        $query = $this->_getEntityManager()->createQuery('SELECT ST_AsText(ST_GeogFromWKB(ST_GeogFromText(\'LINESTRING(-113.98 39.198,-113.981 39.195)\'))) FROM Jsor\\Doctrine\\PostGIS\\PointsEntity');
        $result = $query->getSingleResult();
        array_walk_recursive($result, function (&$data) {
            if (is_resource($data)) {
                $data = stream_get_contents($data);
                if (false !== ($pos = strpos($data, 'x'))) {
                    $data = substr($data, $pos + 1);
                }
            }
            if (is_string($data)) {
                $data = trim($data);
            }
        });
        $expected = array(1 => 'LINESTRING(-113.98 39.198,-113.981 39.195)');
        $this->assertEquals($expected, $result, '', 0.0001);
    }
ST_GeogFromWKBTest