diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3729cdb..f447cad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,8 @@ name: CI on: push: + branches: + - master pull_request: env: @@ -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: diff --git a/tests/GeometryEngineTest.php b/tests/GeometryEngineTest.php index 1bb2261..bfe5ac1 100644 --- a/tests/GeometryEngineTest.php +++ b/tests/GeometryEngineTest.php @@ -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(); @@ -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)'], ];