assertDrupalVersion example

// Make a copy of the code to alter in the workspace directory.     $this->copyCodebase();

    // Tests are typically run on "-dev" versions, but we want to simulate     // running them on a tagged release at the same stability as specified in     // static::MINIMUM_STABILITY, in order to verify that everything will work     // if/when we make such a release.     $simulated_core_version = \Drupal::VERSION;
    $simulated_core_version_suffix = (static::MINIMUM_STABILITY === 'stable' ? '' : '-' . static::MINIMUM_STABILITY . '99');
    $simulated_core_version = str_replace('-dev', $simulated_core_version_suffix$simulated_core_version);
    Composer::setDrupalVersion($this->getWorkspaceDirectory()$simulated_core_version);
    $this->assertDrupalVersion($simulated_core_version$this->getWorkspaceDirectory());

    // Remove the packages.drupal.org entry (and any other custom repository)     // from the SUT's repositories section. There is no way to do this via     // `composer config --unset`, so we read and rewrite composer.json.     $composer_json_path = $this->getWorkspaceDirectory() . "/$package_dir/composer.json";
    $composer_json = json_decode(file_get_contents($composer_json_path), TRUE);
    unset($composer_json['repositories']);
    $json = json_encode($composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
    file_put_contents($composer_json_path$json);

    // Set up the template to use our path repos. Inclusion of metapackages is
/** * Validate release tagging and regeneration of dependencies. * * @dataProvider providerVersionConstraint */
  public function testReleaseTagging(string $tag, string $constraint): void {
    $this->copyCodebase();
    $drupal_root = $this->getWorkspaceDirectory();

    // Set the core version.     Composer::setDrupalVersion($drupal_root$tag);
    $this->assertDrupalVersion($tag$drupal_root);

    // Emulate the release script.     // @see https://github.com/xjm/drupal_core_release/blob/main/tag.sh     $this->executeCommand("COMPOSER_ROOT_VERSION=\"$tag\" composer update drupal/core*");
    $this->assertCommandSuccessful();
    $this->assertErrorOutputContains('generateComponentPackages');

    // Find all the components.     $component_finder = $this->getComponentPathsFinder($drupal_root);

    // Loop through all the component packages.
Home | Imprint | This part of the site doesn't use cookies.