From be441aa368ef7f1e5a8dd115c065caa172f95a6a Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Wed, 8 May 2019 07:37:11 +1000 Subject: [PATCH] Fix Asset builder test by altering error_reporting level to match Drupal and changing regex to not care about HTTP version --- tests/phpunit/E2E/Core/AssetBuilderTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } } -- 2.25.1