Skip to content

Conversation

pierredup
Copy link
Contributor

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tickets N/A
License MIT
Doc PR N/A

This fixes the current failing tests

@pierredup pierredup changed the title Fix tests [WIP] Fix tests Oct 26, 2020
@pierredup pierredup changed the title [WIP] Fix tests Fix tests Oct 26, 2020
require end($phpunitInstalls).'/vendor/autoload.php';
$phpunitLoader = require end($phpunitInstalls).'/vendor/autoload.php';
$phpunitLoader->unregister();
$phpunitLoader->register();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit hacky, but it's required in order to not prepend the PHPUnit autoloader, as it is registered before the normal autoloader. So this causes issues specifically with the Composer\InstalledVersions class, which is loaded from the vendor/.phpunit/8.3/vendor directory instead of the one in the standard vendor directory.
So here we need to unregister the autoloader and re-register it so that is it appended to the queue

Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much! I just rebased your PR, let's see if the tests are green, then merge.

@dunglas dunglas merged commit 6971a35 into api-platform:2.5 Oct 26, 2020
@dunglas
Copy link
Member

dunglas commented Oct 26, 2020

Thanks @pierredup! It's very much appreciated.

@pierredup pierredup deleted the fix-tests branch October 26, 2020 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants