From: Seamus Lee Date: Tue, 7 May 2019 21:37:11 +0000 (+1000) Subject: Fix Asset builder test by altering error_reporting level to match Drupal and changing... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=be441aa368ef7f1e5a8dd115c065caa172f95a6a;p=civicrm-core.git Fix Asset builder test by altering error_reporting level to match Drupal and changing regex to not care about HTTP version --- diff --git a/tests/phpunit/E2E/Core/AssetBuilderTest.php b/tests/phpunit/E2E/Core/AssetBuilderTest.php index 19df9a3c1c..4ddded6d47 100644 --- a/tests/phpunit/E2E/Core/AssetBuilderTest.php +++ b/tests/phpunit/E2E/Core/AssetBuilderTest.php @@ -162,9 +162,13 @@ class AssetBuilderTest extends \CiviEndToEndTestCase { public function testInvalid() { \Civi::service('asset_builder')->setCacheEnabled(FALSE); $url = \Civi::service('asset_builder')->getUrl('invalid.json'); + // WordPress has different error reporting to Drupal so manually set to Drupal + $previousErrorReporting = error_reporting(1); $this->assertEmpty(file_get_contents($url)); - $this->assertNotEmpty(preg_grep(';HTTP/1.1 404;', $http_response_header), + $this->assertNotEmpty(preg_grep(';HTTP/\d+.\d+ 404;', $http_response_header), 'Expect to find HTTP 404. Found: ' . json_encode(preg_grep(';^HTTP;', $http_response_header))); + // Now Reset Error Reporting. + error_reporting($previousErrorReporting); } }