From 37bfb289b869db6ff4d4e3b9bdfd424da84005f6 Mon Sep 17 00:00:00 2001 From: Ollie Date: Wed, 10 Jun 2026 10:14:07 +0100 Subject: [PATCH] tests: prevent output in phpunit tests * Modify `ElasticSearchIndexDeleteTest` so it doesn't print output. * `beStrictAboutOutputDuringTests` marks tests as "risky" if there is output printed. * `failOnRisky` makes the test suite fail if any tests are marked as "risky". Bug: T428716 --- phpunit.xml | 2 ++ tests/Jobs/Integration/ElasticSearchIndexDeleteTest.php | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 0c781fe2..e3bc80d0 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -9,6 +9,8 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false" + beStrictAboutOutputDuringTests="true" + failOnRisky="true" > diff --git a/tests/Jobs/Integration/ElasticSearchIndexDeleteTest.php b/tests/Jobs/Integration/ElasticSearchIndexDeleteTest.php index 243641d2..625e2ec3 100644 --- a/tests/Jobs/Integration/ElasticSearchIndexDeleteTest.php +++ b/tests/Jobs/Integration/ElasticSearchIndexDeleteTest.php @@ -48,12 +48,11 @@ public function makeRequest($url, $method = 'GET') { ); $response = $curlRequest->execute(); $err = $curlRequest->error(); - var_dump($response); + $curlRequest->close(); if ($err) { - var_dump($err); + $this->fail("Request returned an error: {$err}"); } - $curlRequest->close(); return json_decode($response, true); }