From f89b437335f27f4be433a06048f6f509790b04b8 Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Wed, 5 Jun 2024 22:10:35 +0200 Subject: [PATCH 1/3] Upgrade CI to postgis/postgis:16-3.4 --- .github/workflows/ci.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3729cdb..fade7f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -148,17 +148,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: From 5e5272bffbe29d9f7420d813df28b42dfbee306e Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Wed, 5 Jun 2024 21:54:18 +0200 Subject: [PATCH 2/3] Fix tests for GeometryEngine::boundary() --- tests/GeometryEngineTest.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) 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)'], ]; From f88ff0724ef83b2ed1336169534df376e1ecf743 Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Thu, 6 Jun 2024 23:02:33 +0200 Subject: [PATCH 3/3] Prevent CI from running twice when creating a pull request in another branch --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fade7f2..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: