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);
}
}