Jsor\Doctrine\PostGIS\Event\DBALSchemaEventSubscriberTest::testListTableColumns PHP Method

testListTableColumns() public method

    public function testListTableColumns()
    {
        $columns = $this->sm->listTableColumns('points');
        $this->assertArrayHasKey('point', $columns);
        $this->assertEquals('point', strtolower($columns['point']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeometryType', $columns['point']->getType());
        $this->assertEquals(false, $columns['point']->getUnsigned());
        $this->assertEquals(true, $columns['point']->getNotnull());
        $this->assertEquals(null, $columns['point']->getDefault());
        $this->assertInternalType('array', $columns['point']->getPlatformOptions());
        $this->assertEquals('POINT', $columns['point']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(0, $columns['point']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_2d', $columns);
        $this->assertEquals('point_2d', strtolower($columns['point_2d']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeometryType', $columns['point_2d']->getType());
        $this->assertEquals(false, $columns['point_2d']->getUnsigned());
        $this->assertEquals(true, $columns['point_2d']->getNotnull());
        $this->assertEquals(null, $columns['point_2d']->getDefault());
        $this->assertInternalType('array', $columns['point_2d']->getPlatformOptions());
        $this->assertEquals('POINT', $columns['point_2d']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(3785, $columns['point_2d']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_3dz', $columns);
        $this->assertEquals('point_3dz', strtolower($columns['point_3dz']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeometryType', $columns['point_3dz']->getType());
        $this->assertEquals(false, $columns['point_3dz']->getUnsigned());
        $this->assertEquals(true, $columns['point_3dz']->getNotnull());
        $this->assertEquals(null, $columns['point_3dz']->getDefault());
        $this->assertInternalType('array', $columns['point_3dz']->getPlatformOptions());
        $this->assertEquals('POINTZ', $columns['point_3dz']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(3785, $columns['point_3dz']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_3dm', $columns);
        $this->assertEquals('point_3dm', strtolower($columns['point_3dm']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeometryType', $columns['point_3dm']->getType());
        $this->assertEquals(false, $columns['point_3dm']->getUnsigned());
        $this->assertEquals(true, $columns['point_3dm']->getNotnull());
        $this->assertEquals(null, $columns['point_3dm']->getDefault());
        $this->assertInternalType('array', $columns['point_3dm']->getPlatformOptions());
        $this->assertEquals('POINTM', $columns['point_3dm']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(3785, $columns['point_3dm']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_2d_nosrid', $columns);
        $this->assertEquals('point_4d', strtolower($columns['point_4d']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeometryType', $columns['point_4d']->getType());
        $this->assertEquals(false, $columns['point_4d']->getUnsigned());
        $this->assertEquals(true, $columns['point_4d']->getNotnull());
        $this->assertEquals(null, $columns['point_4d']->getDefault());
        $this->assertInternalType('array', $columns['point_4d']->getPlatformOptions());
        $this->assertEquals('POINTZM', $columns['point_4d']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(3785, $columns['point_4d']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_2d_nullable', $columns);
        $this->assertEquals('point_2d_nullable', strtolower($columns['point_2d_nullable']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeometryType', $columns['point_2d_nullable']->getType());
        $this->assertEquals(false, $columns['point_2d_nullable']->getUnsigned());
        $this->assertEquals(false, $columns['point_2d_nullable']->getNotnull());
        //$this->assertEquals('NULL::geometry', $columns['point_2d_nullable']->getDefault());
        $this->assertInternalType('array', $columns['point_2d_nullable']->getPlatformOptions());
        $this->assertEquals('POINT', $columns['point_2d_nullable']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(3785, $columns['point_2d_nullable']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_2d_nosrid', $columns);
        $this->assertEquals('point_2d_nosrid', strtolower($columns['point_2d_nosrid']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeometryType', $columns['point_2d_nosrid']->getType());
        $this->assertEquals(false, $columns['point_2d_nosrid']->getUnsigned());
        $this->assertEquals(true, $columns['point_2d_nosrid']->getNotnull());
        $this->assertEquals(null, $columns['point_2d_nosrid']->getDefault());
        $this->assertInternalType('array', $columns['point_2d_nosrid']->getPlatformOptions());
        $this->assertEquals('POINT', $columns['point_2d_nosrid']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(0, $columns['point_2d_nosrid']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_geography_2d', $columns);
        $this->assertEquals('point_geography_2d', strtolower($columns['point_geography_2d']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeographyType', $columns['point_geography_2d']->getType());
        $this->assertEquals(false, $columns['point_geography_2d']->getUnsigned());
        $this->assertEquals(true, $columns['point_geography_2d']->getNotnull());
        $this->assertEquals(null, $columns['point_geography_2d']->getDefault());
        $this->assertInternalType('array', $columns['point_geography_2d']->getPlatformOptions());
        $this->assertEquals('POINT', $columns['point_geography_2d']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(4326, $columns['point_geography_2d']->getCustomSchemaOption('srid'));
        // ---
        $this->assertArrayHasKey('point_geography_2d_srid', $columns);
        $this->assertEquals('point_geography_2d_srid', strtolower($columns['point_geography_2d_srid']->getName()));
        $this->assertInstanceOf('Jsor\\Doctrine\\PostGIS\\Types\\GeographyType', $columns['point_geography_2d_srid']->getType());
        $this->assertEquals(false, $columns['point_geography_2d_srid']->getUnsigned());
        $this->assertEquals(true, $columns['point_geography_2d_srid']->getNotnull());
        $this->assertEquals(null, $columns['point_geography_2d_srid']->getDefault());
        $this->assertInternalType('array', $columns['point_geography_2d_srid']->getPlatformOptions());
        $this->assertEquals('POINT', $columns['point_geography_2d_srid']->getCustomSchemaOption('geometry_type'));
        $this->assertEquals(4326, $columns['point_geography_2d_srid']->getCustomSchemaOption('srid'));
    }