`E2E_Cache_*Test` raises dependency-hell in D8
Overview
The end-to-end tests for the cache interfaces rely on the baseline tests from https://github.com/php-cache/integration-tests. This creates dependency-hell when trying to run tests on D8.
Reproduction steps
$ composer init
...
$ composer require civicrm/civicrm-core:dev-master pear/validate_finance_creditcard:dev-master
...
$ composer install --dev
...
Nothing to install or update
$ find -name SimpleCacheTest.php
...(no files)...
Current behaviour
There is no way to prompt composer to give you the dependencies needed for running Civi's end-to-end tests.
You can work-around this in the top-level project by running:
composer require "cache/integration-tests:dev-master#b97328797ab199f0ac933e39842a86ab732f21f9"
But that's not sustainable...
Expected behaviour
You should be able to get the dependencies for E2E tests without knowing the exact SHA revision of a transitive dependency.
Comments
- Previously, we imported this code into
civicrm-packages.git
and made some alterations to allow it run well. - IIRC, there was concern that it used the older PHPUnit base-class (
\PHPUnit_Framework_TestCase
) instead of the newer PHP base-class (\PHPUnit\Framework\TestCase
). - Later, we normalized the dependency - removing it from
civicrm-packages.git
and instead pulling the dependency viacomposer
andrequire-dev
.
In a more just world, that would be a good change.
Here are the problems:
- For running E2E tests on D8, you need to create a top-level project which is not CiviCRM. Consequently, it doesn't pull in the
require-dev
items forcivicrm-core
. - Even if there were a composer command to "go get the transitive dev dependencies for civicrm-core (but preferrably not all dev deps for the entire pkg tree)", the upstream
cache/integration-tests
project has not made a stable release that uses\PHPUnit\Framework\TestCase
. All the published versions on packagist use\PHPUnit_Framework_TestCase
. And in the time since we started usingdev-master
, they've added an ill-declared dependency onsymfony/phpunit-bridge
.
I don't see a good option here. Ideas:
- Put
SimpleCacheTest.php
back incivicrm-packages.git
- Fork
cache/integration-tests
. Give it a new name and a tagged version number. Incivicrm-core.git:composer.json
, list this new package as a standardrequire
rather thanrequire-dev
. - Update
composer
's design (via patch or plugin) to allow pulling in supplemental dev deps for this situation. (Maybe something along the lines of merge-plugin?)