Commit 3e5c6f51 authored by catch's avatar catch
Browse files

Issue #3196470 by mxr576, longwave:...

Issue #3196470 by mxr576, longwave: KernelTestBaseTest::testOutboundHttpRequest() does not perform any assertion
parent 5cd5a9d0
Loading
Loading
Loading
Loading
+6 −3
Changes for core/tests/Drupal/KernelTests/KernelTestBaseTest.php: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -175,10 +175,13 @@ public function testOutboundHttpRequest() {
    // which checks the DRUPAL_TEST_IN_CHILD_SITE constant, that is not defined
    // in Kernel tests.
    try {
      $this->container->get('http_client')->get('http://example.com');
      /** @var \GuzzleHttp\Psr7\Response $response */
      $response = $this->container->get('http_client')->head('http://example.com');
      self::assertEquals(200, $response->getStatusCode());
    }
    catch (GuzzleException $e) {
      // Ignore any HTTP errors.
    catch (\Throwable $e) {
      // Ignore any HTTP errors, any other exception is considered an error.
      self::assertInstanceOf(GuzzleException::class, $e, sprintf('Asserting that a possible exception is thrown. Got "%s" with message: "%s".', get_class($e), $e->getMessage()));
    }
  }