From c199b7ca04b057aa6d1f83490ccf19cc249d2fdb Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 16 Jun 2021 17:14:03 +1200 Subject: [PATCH] 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 --- CRM/Api4/Services.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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'); } } -- 2.25.1