Api3TestTrait - Only run api4 tests if api4 is present
authorTim Otten <totten@civicrm.org>
Thu, 19 Sep 2019 19:16:23 +0000 (15:16 -0400)
committerTim Otten <totten@civicrm.org>
Thu, 19 Sep 2019 19:26:43 +0000 (15:26 -0400)
Civi/Test/Api3TestTrait.php

index 1c99c0490b42d3e61f84014020a4704a7d43216e..5e6b25075ef3c25ae5debd14ce4d67e76de67153 100644 (file)
@@ -22,7 +22,12 @@ trait Api3TestTrait {
    * @return array
    */
   public function versionThreeAndFour() {
-    return [[3], [4]];
+    $r = [[3]];
+    global $civicrm_root;
+    if (file_exists("$civicrm_root/Civi/Api4") || file_exists("$civicrm_root/ext/api4")) {
+      $r[] = [4];
+    }
+    return $r;
   }
 
   /**