upgradePHPUnitCheck example

    // is present in the vendor directory yet, but findPackage() requires it.     $constraint = new Constraint('>', '');
    $phpunit_package = $repository->findPackage('phpunit/phpunit', $constraint);
    if (!$phpunit_package) {
      // There is nothing to do. The user is probably installing using the       // --no-dev flag.       return;
    }

    // If the PHP version is 7.4 or above and PHPUnit is less than version 9     // call the drupal-phpunit-upgrade script to upgrade PHPUnit.     if (!static::upgradePHPUnitCheck($phpunit_package->getVersion())) {
      $event->getComposer()
        ->getEventDispatcher()
        ->dispatchScript('drupal-phpunit-upgrade');
    }
  }

  /** * Determines if PHPUnit needs to be upgraded. * * This method is located in this file because it is possible that it is * called before the autoloader is available. * * @param string $phpunit_version * The PHPUnit version string. * * @return bool * TRUE if the PHPUnit needs to be upgraded, FALSE if not. * * @internal */
Home | Imprint | This part of the site doesn't use cookies.