Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/palantirnet/drupal-rector

A developer utility for automatically upgrading deprecated code for Drupal 9
https://github.com/palantirnet/drupal-rector

drupal hacktoberfest php rector

Last synced: about 16 hours ago
JSON representation

A developer utility for automatically upgrading deprecated code for Drupal 9

Awesome Lists containing this project

README

        

# Automated testing

## Unit testing

The Drupal Rector project has PHPUnit tests, extending the testing suite functionality provided by Rector. This allows
the project to have confidence in the written Rector rules. To run the unit tests, there are different system requirements
than if you ran Drupal Rector against your Drupal site.

To run the PHPUnit tests:

* Clone your fork of the repository
* Run `composer install`
* Run `php vendor/bin/phpunit`

See the `.github/workflows/phpunit.yml` workflow for an example.

### Writing a PHPUnit test

For now, please see the example in `tests/src/Rector/Deprecation/DatetimeStorageTimezoneRector`.

## Installation test

GitHub Action workflows test that this package can be installed. See the workflows in `.github/workflows`.

## Rector functional testing

The functional test takes the `rector_examples` directory in this package and copies it to a Drupal code base.

The workflow then runs `vendor/bin/rector process web/modules/custom/rector_examples` to apply all of the appropriate Rector rules.

Then, the `diff` command is run to verify the changes match the expected results as found in the `rector_examples_updated` directory.

To add new tests, create a sample file in `rector_examples` and a copy with the expected changes into `rector_examples_updated`.