From f8fc4847be028c4506c9c1a0f74183ba48fc0a61 Mon Sep 17 00:00:00 2001 From: Andrew Hunt Date: Wed, 11 Mar 2020 20:00:13 -0400 Subject: [PATCH] Consolidate to single constant for minimum PHP version See https://github.com/civicrm/civicrm-core/pull/16753 --- civicrm.module | 6 +++--- tests/phpunit/CiviBackdrop/PHPVersionTest.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/civicrm.module b/civicrm.module index 86976f8..3f948f0 100644 --- a/civicrm.module +++ b/civicrm.module @@ -35,12 +35,12 @@ define('CIVICRM_UF_HEAD', TRUE); /** * Minimum required PHP * - * Note: This duplicates CRM_Upgrade_Form::MINIMUM_PHP_VERSION. The - * duplication helps avoid a dependency-loop. (Reading `Form::MINIMUM_PHP_VERSION` + * Note: This duplicates CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER. The + * duplication helps avoid a dependency-loop. (Reading `CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER` * requires loading `civicrm.settings.php`, but that triggers a parse-error * on PHP 5.x.) * - * @see CRM_Upgrade_Form::MINIMUM_PHP_VERSION + * @see CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER * @see CiviDrupal\PhpVersionTest::testConstantMatch() */ define('CIVICRM_DRUPAL_PHP_MINIMUM', '7.1.0'); diff --git a/tests/phpunit/CiviBackdrop/PHPVersionTest.php b/tests/phpunit/CiviBackdrop/PHPVersionTest.php index 00e116a..833be7c 100644 --- a/tests/phpunit/CiviBackdrop/PHPVersionTest.php +++ b/tests/phpunit/CiviBackdrop/PHPVersionTest.php @@ -7,14 +7,14 @@ class PhpVersionTest extends \PHPUnit\Framework\TestCase implements EndToEndInterface { /** - * CIVICRM_DRUPAL_PHP_MINIMUM (civicrm.module) should match MINIMUM_PHP_VERSION (CRM/Upgrade/Form.php). + * CIVICRM_DRUPAL_PHP_MINIMUM (civicrm.module) should match CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER. */ public function testConstantMatch() { $constantFile = $this->getBackdropModulePath() . '/civicrm.module'; $this->assertFileExists($constantFile); $content = file_get_contents($constantFile); if (preg_match(";define\\('CIVICRM_DRUPAL_PHP_MINIMUM', '(.*)'\\);", $content, $m)) { - $this->assertEquals(\CRM_Upgrade_Form::MINIMUM_PHP_VERSION, $m[1]); + $this->assertEquals(\CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER, $m[1]); } else { $this->fail('Failed to find CIVICRM_DRUPAL_PHP_MINIMUM in ' . $constantFile); @@ -22,13 +22,13 @@ public function testConstantMatch() { } /** - * "php" requirement (civicrm.info) should match MINIMUM_PHP_VERSION (CRM/Upgrade/Form.php). + * "php" requirement (civicrm.info) should match CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER. */ public function testInfoMatch() { $infoFile = $this->getBackdropModulePath() . '/civicrm.info'; $this->assertFileExists($infoFile); $info = drupal_parse_info_file($infoFile); - $expectMajorMinor = preg_replace(';^(\d+\.\d+)\..*$;', '\1', \CRM_Upgrade_Form::MINIMUM_PHP_VERSION); + $expectMajorMinor = preg_replace(';^(\d+\.\d+)\..*$;', '\1', \CRM_Upgrade_Incremental_General::MIN_INSTALL_PHP_VER); $this->assertEquals($expectMajorMinor, $info['php']); }