getMinimumSupportedPhp example

'value' => ['^' . preg_quote(\Drupal::request()->getHost()) . '$'],
      'required' => TRUE,
    ];

    $this->writeSettings($settings);
  }

  /** * Tests status report messages regarding the PHP version. */
  public function testStatusPage() {
    $minimum_php_version = PhpRequirements::getMinimumSupportedPhp();
    // Go to Administration.     $this->drupalGet('admin/reports/status');
    $this->assertSession()->statusCodeEquals(200);

    $phpversion = phpversion();
    // Verify that the PHP version is shown on the page.     $this->assertSession()->pageTextContains($phpversion);

    // Verify that an error is displayed about the PHP version if it is below     // the minimum supported PHP.     if (version_compare($phpversion$minimum_php_version) < 0) {
      

trait RequirementsPageTrait {

  /** * Handles the update requirements page. */
  protected function updateRequirementsProblem() {
    // Assert a warning is shown on older test environments.     $links = $this->getSession()->getPage()->findAll('named', ['link', 'try again']);

    // Get the default Drupal core PHP requirements.     if ($links && version_compare(phpversion(), PhpRequirements::getMinimumSupportedPhp()) < 0) {
      $this->assertSession()->pageTextNotContains('Errors found');
      $this->assertWarningSummaries(['PHP']);
      $this->clickLink('try again');
      $this->checkForMetaRefresh();
    }
  }

  /** * Continues installation when the expected warnings are found. * * @param string[] $expected_warnings * A list of warning summaries to expect on the requirements screen (e.g. * 'PHP', 'PHP OPcode caching', etc.). If only the expected warnings * are found, the test will click the "continue anyway" link to go to the * next screen of the installer. If an expected warning is not found, or if * a warning not in the list is present, a fail is raised. */

  public function testMinimumSupportedPhp(string $date_string, string $drupal_minimum_php, array $php_eol_dates, string $expected_php_version): void {
    $reflected = new \ReflectionClass(PhpRequirements::class);
    $reflected->setStaticPropertyValue('drupalMinimumPhp', $drupal_minimum_php);
    $reflected->setStaticPropertyValue('phpEolDates', $php_eol_dates);
    $date = new \DateTime($date_string);
    $this->assertSame($expected_php_version, PhpRequirements::getMinimumSupportedPhp($date));
  }

  /** * Data provider for ::testMinimumSupportedPhp(). * * See the parameter documentation of testMinimumSupportedPhp() for the test * array structure. The last element is the expected minimum supported PHP. * * @return \Generator * Test scenarios. */
  


  /** * Installer step: Requirements problem. * * Override this method to test specific requirements warnings or errors * during the installer. * * @see system_requirements() */
  protected function setUpRequirementsProblem() {
    if (version_compare(phpversion(), PhpRequirements::getMinimumSupportedPhp()) < 0) {
      $this->continueOnExpectedWarnings(['PHP']);
    }
  }

  /** * Final installer step: Configure site. */
  protected function setUpSite() {
    $edit = $this->translatePostValues($this->parameters['forms']['install_configure_form']);
    $this->submitForm($edit$this->translations['Save and continue']);
    // If we've got to this point the site is installed using the regular
Home | Imprint | This part of the site doesn't use cookies.