From 0889f3c886655900e75af72236d09caf9a613f99 Mon Sep 17 00:00:00 2001 From: Tom Stovall Date: Tue, 4 Feb 2025 15:32:05 -0800 Subject: [PATCH] Port should always be an integer --- src/Plugin/SolrConnector/PantheonSolrConnector.php | 2 +- tests/Unit/EndpointServiceTest.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Plugin/SolrConnector/PantheonSolrConnector.php b/src/Plugin/SolrConnector/PantheonSolrConnector.php index 591c81ba..fed1b22d 100644 --- a/src/Plugin/SolrConnector/PantheonSolrConnector.php +++ b/src/Plugin/SolrConnector/PantheonSolrConnector.php @@ -122,7 +122,7 @@ public static function getPlatformConfig() { return [ 'scheme' => getenv('PANTHEON_INDEX_SCHEME'), 'host' => getenv('PANTHEON_INDEX_HOST'), - 'port' => getenv('PANTHEON_INDEX_PORT'), + 'port' => intval(getenv('PANTHEON_INDEX_PORT')), 'path' => getenv('PANTHEON_INDEX_PATH'), 'core' => getenv('PANTHEON_INDEX_CORE'), 'schema' => getenv('PANTHEON_INDEX_SCHEMA'), diff --git a/tests/Unit/EndpointServiceTest.php b/tests/Unit/EndpointServiceTest.php index 8792fda1..845e20f5 100644 --- a/tests/Unit/EndpointServiceTest.php +++ b/tests/Unit/EndpointServiceTest.php @@ -22,7 +22,7 @@ public function testURIGeneration() { $ep = new Endpoint([ 'scheme' => 'one', 'host' => 'two', - 'port' => '1234', + 'port' => 1234, 'path' => 'server-path', 'core' => '/core-name', 'schema' => '/schema-path', @@ -34,7 +34,8 @@ public function testURIGeneration() { $this->assertEquals('/core-name', $ep->getCore()); $this->assertEquals('server-path', $ep->getPath()); $this->assertEquals('one', $ep->getScheme()); - $this->assertEquals('1234', $ep->getPort()); + // If port is a string in the test, it should be an integer. + $this->assertEquals(1234, $ep->getPort()); $this->assertEquals('one://two:1234/', $ep->getBaseUri()); $this->assertEquals( 'one://two:1234/server-path/core-name/',