From: Eileen McNaughton Date: Wed, 16 Jun 2021 05:14:03 +0000 (+1200) Subject: Add file_exists check on loading services xml X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c199b7ca04b057aa6d1f83490ccf19cc249d2fdb;p=civicrm-core.git Add file_exists check on loading services xml I'm hitting an issue where we run unit tests on our own code base and this is hitting file-not-found We don't package the tests directory with the tarball so it's not there. The alternative is to move it to the Civi\test folder if it's important that it be there for non-core tests --- diff --git a/CRM/Api4/Services.php b/CRM/Api4/Services.php index fe88674de4..18bab2f7ad 100644 --- a/CRM/Api4/Services.php +++ b/CRM/Api4/Services.php @@ -58,7 +58,9 @@ class CRM_Api4_Services { ); } - if (defined('CIVICRM_UF') && CIVICRM_UF === 'UnitTests') { + if (defined('CIVICRM_UF') && CIVICRM_UF === 'UnitTests' + && file_exists('tests/phpunit/api/v4/services.xml') + ) { $loader->load('tests/phpunit/api/v4/services.xml'); } }