Skip to content

Commit

Permalink
Merge pull request #49 from brick/upgrade_postgis
Browse files Browse the repository at this point in the history
Upgrade CI to postgis/postgis:16-3.4
  • Loading branch information
BenMorel authored Jun 6, 2024
2 parents 13f4cc0 + f88ff07 commit 225ab89
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CI

on:
push:
branches:
- master
pull_request:

env:
Expand Down Expand Up @@ -148,17 +150,19 @@ jobs:
php-version:
- "8.1"

services:
postgis:
image: "postgis/postgis:16-3.4"
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PostgreSQL with PostGIS
uses: huaxk/postgis-action@v1
with:
postgresql version: 'latest'
postgresql password: 'postgres'
postgresql user: 'postgres'

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
20 changes: 13 additions & 7 deletions tests/GeometryEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,10 +323,10 @@ public static function providerPointOnSurface() : array

/**
* @param string $geometry The WKT of the geometry to test.
* @param string $boundary The WKT of the expected boundary.
* @param string|string[] $boundary The WKT of the expected boundary. If multiple possible results, an array.
*/
#[DataProvider('providerBoundary')]
public function testBoundary(string $geometry, string $boundary) : void
public function testBoundary(string $geometry, string|array $boundary) : void
{
$geometryEngine = $this->getGeometryEngine();

Expand All @@ -344,16 +344,22 @@ public function testBoundary(string $geometry, string $boundary) : void
$this->expectException(GeometryEngineException::class);
}

self::assertSame($boundary, $geometryEngine->boundary($geometry)->asText());
$actualBoundary = $geometryEngine->boundary($geometry);

if (is_array($boundary)) {
self::assertContains($actualBoundary->asText(), $boundary);
} else {
self::assertSame($boundary, $actualBoundary->asText());
}
}

public static function providerBoundary() : array
{
return [
['POINT (1 2)', 'GEOMETRYCOLLECTION EMPTY'],
['POINT Z (2 3 4)', 'GEOMETRYCOLLECTION EMPTY'],
['POINT M (3 4 5)', 'GEOMETRYCOLLECTION EMPTY'],
['POINT ZM (4 5 6 7)', 'GEOMETRYCOLLECTION EMPTY'],
['POINT (1 2)', ['POINT EMPTY', 'GEOMETRYCOLLECTION EMPTY']],
['POINT Z (2 3 4)', ['POINT Z EMPTY', 'GEOMETRYCOLLECTION EMPTY']],
['POINT M (3 4 5)', ['POINT M EMPTY', 'GEOMETRYCOLLECTION EMPTY']],
['POINT ZM (4 5 6 7)', ['POINT ZM EMPTY', 'GEOMETRYCOLLECTION EMPTY']],
['LINESTRING (1 1, 0 0, -1 1)', 'MULTIPOINT (1 1, -1 1)'],
['POLYGON ((1 1, 0 0, -1 1, 1 1))', 'LINESTRING (1 1, 0 0, -1 1, 1 1)'],
];
Expand Down

0 comments on commit 225ab89

Please sign in to comment.