Skip to content

Commit

Permalink
Document testing locally
Browse files Browse the repository at this point in the history
I wanted to be able to run the tests locally before submitting a PR, and
didn't see anything. This is a simple addition based on
`.github/workflows/ci.yml` but improvements are welcome!
  • Loading branch information
xurizaemon committed Dec 21, 2022
1 parent c86083c commit ddabe52
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
35 changes: 35 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contributing

Features and bug fixes are welcome! First-time contributors can jump in with the issues tagged [good first issue](https://github.com/jhedstrom/DrupalDriver/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).

## Testing

Testing is performed automatically in Github Actions when a PR is submitted. To execute tests locally before submitting a PR, you'll need [Docker and Docker Compose](https://docs.docker.com/engine/install/).

Configure your test environment:
```
export PHP_VERSION=8.1
export DRUPAL_VERSION=10
export DOCKER_USER_ID=${UID}
```

Prepare environment for testing:
```
docker-compose up -d
docker-compose exec -T php composer self-update
docker-compose exec -u ${DOCKER_USER_ID} -T php composer require --no-interaction --dev --no-update drupal/core:^${DRUPAL_VERSION}
docker-compose exec -T php composer install
```

Execute all tests:
```
docker-compose exec -T php composer test
```

Execute specific tests, eg just PHPUnit's Drupal7FieldHandlerTest:
```
docker-compose exec -T php phpunit --filter Drupal7FieldHandlerTest
```

- Check the changes from `composer require` are not included in your submitted PR.
- Before testing another PHP or Drupal version, remove `composer.lock` and `vendor/`
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,13 @@ $node = (object) array(
$driver->createNode($node);
```

### Contributing

Features and bug fixes are welcome! First-time contributors can jump in with the
issues tagged [good first issue](https://github.com/jhedstrom/DrupalDriver/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22).

See [CONTRIBUTING.md](https://github.com/jhedstrom/DrupalDriver/blob/master/CONTRIBUTING.md) for more information.

### Release notes

See [CHANGELOG](CHANGELOG.MD).

0 comments on commit ddabe52

Please sign in to comment.