Skip to content

Commit

Permalink
Merge pull request #200 from bluehorndigital/fix-conflicts
Browse files Browse the repository at this point in the history
Remove conflicts on rector/rector
  • Loading branch information
agentrickard authored May 24, 2022
2 parents 7ee195e + 3eb40a2 commit 28d2a40
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 150 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,19 @@ The key is the fully qualified class name of the Rector rule. The key is the yam

The index file is used in part to provide automated updates to https://dev.acquia.com/drupal9/deprecation_status/errors which is a helpful way to track coverage. The `PHPStan` messages are listed there as well as in the change record comments throughout the Drupal codebase.

## Pinning dev dependencies

If there are conflicts with Rector, the package version can be conflicted with `conflict` on `rector/rector`.

For development, the `require-dev` is on `rector/rector-src` which is `dev-main` and that includes the `dev-main` of all
its packages.

To properly pin a development release of `rector-src`:

* Set `rector/rector-src` to `dev-main#COMMIT` where `COMMIT` is the tag commit in `rector-src`
* View the tree for the commit on GitHub and it's `composer/installed.json` file (example https://github.com/rectorphp/rector/blob/0.12.18/vendor/composer/installed.json)
* Use the references to pin `require-dev` dependencies.

## Credits

Current development is sponsored by [Palantir.net](https://www.palantir.net).<br/>
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"ast"
],
"require": {
"rector/rector": "~0.12",
"rector/rector": "~0.12.19",
"webflo/drupal-finder": "^1.2"
},
"conflict": {
"rector/rector": ">0.12.17"
"rector/rector": ">0.12.19"
},
"license": "MIT",
"authors": [
Expand Down Expand Up @@ -71,14 +71,14 @@
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpunit/phpunit": "^9.5",
"rector/rector-src": "dev-main#77a4582d5044446b8da43ab91a09082fa0413a23",
"rector/rector-cakephp": "dev-main#eab7b7992e3462c40b2eb8f7ab6d2013eaf20c76",
"rector/rector-doctrine": "dev-main#21431cc9e81990191be9c235e67c631ed518d0a3",
"rector/rector-laravel": "dev-main#31d9892d1f2abd41a118589ad76a065bb24150ea",
"rector/rector-nette": "dev-main#7aa632f0fd210b0795cb92b98e648164049db80e",
"rector/rector-phpoffice": "dev-main#1e12437861bb9e06f776b9f9be5811a7bf219729",
"rector/rector-phpunit": "dev-main#baf6f9eaa1eadc03d61ac6f414077d85b0540dfa",
"rector/rector-symfony": "dev-main#a3ad2a20c028535c7d26ba85bed729d838eb9297",
"rector/rector-src": "dev-main#cbefb243e25ad213b187a55e5e50ec34b627b547",
"rector/rector-cakephp": "dev-main#d1fa93dbf332a0170deaf37467b40735727003fb",
"rector/rector-doctrine": "dev-main#96ff8cbaf186e5d89a88a3ff49b55cb15d04519f",
"rector/rector-laravel": "dev-main#6bee4284d50e84eb5d027ff266801b2a1c903a33",
"rector/rector-nette": "dev-main#0aaf0a6d587b387982a6844538bce58c96cda86f",
"rector/rector-phpoffice": "dev-main#f23c4bf79c1f8a18349ab0b96bba8333dd7b823b",
"rector/rector-phpunit": "dev-main#5952218df3e5240c6e0f67ea8e7b5e004b575e8b",
"rector/rector-symfony": "dev-main#d0a6487e51d4959f4d2d6e0b3e8fa541505309ce",
"symfony/yaml": "^5 || ^6"
}
}
25 changes: 5 additions & 20 deletions config/drupal-phpunit-bootstrap-file.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

use DrupalFinder\DrupalFinder;
use PHPUnit\Runner\Version;
use Rector\Core\Autoloading\BootstrapFilesIncluder;
use Rector\Core\Exception\ShouldNotHappenException;

Expand Down Expand Up @@ -169,24 +168,10 @@ function drupal_phpunit_populate_class_loader($drupalRoot, $vendorRoot) {
// Do class loader population.
drupal_phpunit_populate_class_loader($drupalRoot, $drupalVendorRoot);

// Drupal 8.x supports PHPUnit 6 and 7 and has compatibility traits we must load.
// @link https://git.drupalcode.org/project/drupal/-/tree/8.9.x/core/tests/Drupal/TestTools/PhpUnitCompatibility
// @link https://git.drupalcode.org/project/drupal/-/blob/8.9.x/composer.json#L26
//
// Drupal 9.x supports PHPUnit 8 and 9 and has compatibility traits we must load.
// @link https://git.drupalcode.org/project/drupal/-/tree/9.3.x/core/tests/Drupal/TestTools/PhpUnitCompatibility
// @link https://git.drupalcode.org/project/drupal/-/blob/9.3.x/composer.json#L27
if (class_exists(Version::class)) {
$major = (int) explode('.', Version::id())[0];
require_once $drupalRoot . "/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit{$major}/TestCompatibilityTrait.php";
class_alias("Drupal\TestTools\PhpUnitCompatibility\PhpUnit{$major}\TestCompatibilityTrait", '\Drupal\Tests\PhpunitVersionDependentTestCompatibilityTrait');

// Load the Drupal class writer for PHPUnit to mutate the PHPUnit base
// classes.
// @link https://git.drupalcode.org/project/drupal/-/blob/9.3.x/core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/ClassWriter.php
if ($major >= 8) {
$loader = require $drupalVendorRoot . '/autoload.php';
\DrupalRector\Utility\Drupal9\ClassWriter::mutateTestBase($loader);
$autoloader = require $drupalVendorRoot . '/autoload.php';
if ($autoloader instanceof \Composer\Autoload\ClassLoader) {
if (interface_exists(\PHPUnit\Framework\Test::class)
&& class_exists('Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter')) {
\Drupal\TestTools\PhpUnitCompatibility\PhpUnit8\ClassWriter::mutateTestBase($autoloader);
}
}

120 changes: 0 additions & 120 deletions src/Utility/Drupal9/ClassWriter.php

This file was deleted.

0 comments on commit 28d2a40

Please sign in to comment.