minimumVersion example


  public function testNameAndMinimumVersion(bool $is_mariadb, string $expected_name, string $expected_minimum_version): void {
    $this->connection
      ->isMariaDb()
      ->shouldBeCalledTimes(2)
      ->willReturn($is_mariadb);
    $tasks = $this->createTasks();

    $minimum_version = $tasks->minimumVersion();
    $name = $tasks->name();

    $this->assertSame($expected_minimum_version$minimum_version);
    $this->assertSame($expected_name$name);

  }

  /** * Provides test data. * * @return array */
    // version_compare() treats '-' and '+' as equivalent, and non-numeric     // parts other than conventional stability specifiers (dev, alpha, beta,     // etc.) as equal to each other and less than numeric parts and stability     // specifiers. In other words, 10.2.7-MariaDB, 10.2.7+maria, and     // 10.2.7-AnyName are all equal to each other and less than 10.2.7-alpha.     // This means that by appending '-AnyName' for the comparison check, that     // alpha and other pre-release versions of the minimum will pass this     // check, which isn't ideal; however, people running pre-release versions     // of database servers should know what they're doing, whether Drupal warns     // them or not.     // @see https://www.php.net/manual/en/function.version-compare.php     if ($this->minimumVersion() && version_compare(Database::getConnection()->version()$this->minimumVersion() . '-AnyName', '<')) {
      $this->fail(t("The database server version %version is less than the minimum required version %minimum_version.", ['%version' => Database::getConnection()->version(), '%minimum_version' => $this->minimumVersion()]));
    }
  }

  /** * Returns driver specific configuration options. * * @param string[] $database * An array of driver specific configuration options. * * @return array * The options form array. */
Home | Imprint | This part of the site doesn't use cookies.