diff --git a/src/Plugin/SolrConnector/PantheonSolrConnector.php b/src/Plugin/SolrConnector/PantheonSolrConnector.php index 3bb421bb..f2a4740c 100644 --- a/src/Plugin/SolrConnector/PantheonSolrConnector.php +++ b/src/Plugin/SolrConnector/PantheonSolrConnector.php @@ -129,7 +129,7 @@ public static function getPlatformConfig() { 'path' => getenv('PANTHEON_INDEX_PATH'), 'core' => getenv('PANTHEON_INDEX_CORE'), 'schema' => getenv('PANTHEON_INDEX_SCHEMA'), - 'reload_path' => getenv('PANTHEON_INDEX_RELOAD_PATH') + 'reload_path' => getenv('PANTHEON_INDEX_RELOAD_PATH'), ]; } diff --git a/src/Services/Endpoint.php b/src/Services/Endpoint.php index cb1d001d..8b50afd7 100644 --- a/src/Services/Endpoint.php +++ b/src/Services/Endpoint.php @@ -215,8 +215,8 @@ public function getReloadUri(): string { } /** - * Get the path for Schema Reloads - * + * Get the path for Schema Reloads. + * * @return string * The path for schema reloads **/ diff --git a/src/Services/SchemaPoster.php b/src/Services/SchemaPoster.php index 3b0487aa..49eaa41d 100644 --- a/src/Services/SchemaPoster.php +++ b/src/Services/SchemaPoster.php @@ -140,19 +140,16 @@ protected function reloadServer(): void { $response = $this->getClient()->sendRequest($request); $status_code = $response->getStatusCode(); + $status_logger_content = [ + 'status_code' => $response->getStatusCode(), + 'reason' => $response->getReasonPhrase(), + ]; if ($status_code >= 200 && $status_code < 300) { - $this->logger->info('Server reloaded: {status_code} {reason}', [ - 'status_code' => $response->getStatusCode(), - 'reason' => $response->getReasonPhrase(), - ]); - } - else { - $this->logger->error('Server not reloaded: {status_code} {reason}', [ - 'status_code' => $response->getStatusCode(), - 'reason' => $response->getReasonPhrase(), - ]); - throw new PantheonSearchApiException('Server not reloaded.'); + $this->logger->info('Server reloaded: {status_code} {reason}', $status_logger_content); + return; } + $this->logger->error('Server not reloaded: {status_code} {reason}', $status_logger_content); + throw new PantheonSearchApiException('Server not reloaded.'); } /** diff --git a/tests/Unit/EndpointServiceTest.php b/tests/Unit/EndpointServiceTest.php index 4c3958d2..07c23911 100644 --- a/tests/Unit/EndpointServiceTest.php +++ b/tests/Unit/EndpointServiceTest.php @@ -55,7 +55,8 @@ public function testURIGeneration() { } public function testReloadPath() { - $ep = new Endpoint(["reload_path"=>"/reload"]); - $this->assertEquals("/reload", $ep->getReloadPath()); + $ep = new Endpoint(["reload_path" => "/reload"]); + $this->assertEquals("/reload", $ep->getReloadPath()); } + } diff --git a/tests/Unit/GuzzleClassTest.php b/tests/Unit/GuzzleClassTest.php index ea851c2c..1e08b746 100644 --- a/tests/Unit/GuzzleClassTest.php +++ b/tests/Unit/GuzzleClassTest.php @@ -18,9 +18,9 @@ * @package \Drupal\search_api_pantheon */ class GuzzleClassTest extends TestCase { - + protected $loggerFactory; - + /** * {@inheritdoc} */