Problem/Motivation

in #3274830: Make ProjectInfo work with legacy version numbers we added \Drupal\Tests\automatic_updates\Kernel\ProjectInfoTest::setReleaseMetadataForProjects() to ensure that requests for the update XML, which return our test XML files, does not rely on request order but rather the path of the request, which changes per project.

Proposed resolution

we should just change `\Drupal\Tests\automatic_updates\Kernel\AutomaticUpdatesKernelTestBase::setReleaseMetadata` to do this and get rid of \Drupal\Tests\automatic_updates\Kernel\ProjectInfoTest::setReleaseMetadataForProjects()

So, to clarify, right now we do stuff like this in kernel tests:

$this->setReleaseMetadata([__DIR__ . '/../../fixtures/release-history/drupal.9.8.2.xml']);

What would be better is to do what \Drupal\Tests\automatic_updates\Kernel\ProjectInfoTest::setReleaseMetadataForProjects() does, where we specifically say "for this project, return this release metadata". So, I'd like to see something like this:

$this->setReleaseMetadata([
  'drupal' => __DIR__ . '/../../fixtures/release-history/drupal.9.8.2.xml',
]);

Remaining tasks

  1. Move the approach taken by ProjectInfoTest::setReleaseMetadataForProjects() into AutomaticUpdatesKernelTestBase::setReleaseMetadata(), and update its doc comment to reflect the way it now works.
  2. Change ProjectInfoTest to use setReleaseMetadata(), and remove setReleaseMetadataForProjects().
  3. Change all the calls to setReleaseMetadata() in our kernel tests to use the new format.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tedbow created an issue. See original summary.

tedbow’s picture

phenaproxima’s picture

Issue summary: View changes

Updating the issue summary to more carefully explain the requested change here.

kunal.sachdev’s picture

Assigned: Unassigned » kunal.sachdev

kunal.sachdev’s picture

Status: Active » Needs review
phenaproxima’s picture

Status: Needs review » Needs work

Just a small typo fix. RTBC otherwise!

phenaproxima’s picture

Status: Needs work » Reviewed & tested by the community

Looks great to me. Thanks @kunal.sachdev!

phenaproxima’s picture

Assigned: kunal.sachdev » Unassigned
phenaproxima’s picture

Title: Change AutomaticUpdatesKernelTestBase::setReleaseMetadata() to return metadata based of request path and not request order » Change AutomaticUpdatesKernelTestBase::setReleaseMetadata() to return metadata for different projects based on request path

Re-titling for clarity.

phenaproxima’s picture

Status: Reviewed & tested by the community » Fixed

Merged into 8.x-2.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.