I was looking into a different issue that I wanted to submit a patch for, and I noticed that the unit tests are currently failing. I noticed the following issues:

RootPackageBuilderTest.php

$this->assertCount(2, $root_package['repositories']);

This fails due to test item 3 in the fixture not having any requirements. This means it gets bypassed in RootPackageBuilder at the below section, and only one repository gets added:

if (empty($extension_package['name']) || ((empty($extension_package['require']) && empty($extension_package['require-dev'])))) {
  // Each package must have a name and at least one requirement.
  continue;
}

ExtensionDiscoveryTest.php

This fails during setUp due to the fix implemented for #2473969: composer drupal-rebuild fails with "Required prefix configuration is missing". That said, I'm not sure WHY it fails, as the configuration is set in BaseExtensionDiscovery, and I'd assume the test would use that configuration as it's testing that class.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

chapabu created an issue. See original summary.

chapabu’s picture

I've attached a patch that gets all tests passing again. I added a fourth test extension package in RootPackageBuilderTest.php as I didn't really want to have to refactor the other tests in case we ended up with false positives. This is also the reason the new test extension has the same contents as $extension_packages['test2'].

I also had to amend line 131 in RootPackageBuilderTest.php, as $extension_packages['test3'] gets bypassed as per the issue summary.

I'm not 100% convinced that the fix in ExtensionDiscoveryTest.php is the right way to go. It feels like it should be a mock.

chapabu’s picture

Status: Active » Needs review

  • bojanz committed ca72f04 on 8.x-1.x authored by chapabu
    Issue #2551145 by chapabu: Tests are failing with latest dev release
    
bojanz’s picture

Status: Needs review » Fixed

Big thanks for the test fixes!

I'm fine with the current state of the patch, I just tweaked a code comment.

Status: Fixed » Closed (fixed)

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