Fix Asset builder test by altering error_reporting level to match Drupal and changing...
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 7 May 2019 21:37:11 +0000 (07:37 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Tue, 7 May 2019 21:37:11 +0000 (07:37 +1000)
tests/phpunit/E2E/Core/AssetBuilderTest.php

index 19df9a3c1cd28fab06a15850ec0a9c9d63fa1c2e..4ddded6d47af2bae58d58b757c5284a9bdee2db4 100644 (file)
@@ -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);
   }
 
 }