{"id":19320106,"url":"https://github.com/pronovix/docker-drupal-dev","last_synced_at":"2025-04-22T17:32:44.017Z","repository":{"id":37385083,"uuid":"215531705","full_name":"Pronovix/docker-drupal-dev","owner":"Pronovix","description":"[READ ONLY] Dockerized Drupal development/testing environment","archived":false,"fork":false,"pushed_at":"2024-09-18T10:40:09.000Z","size":57,"stargazers_count":2,"open_issues_count":0,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-09-18T14:17:58.727Z","etag":null,"topics":["behat","docker","drupal","phpunit","testing","wodby"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pronovix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-16T11:28:40.000Z","updated_at":"2024-09-18T10:40:13.000Z","dependencies_parsed_at":"2024-09-18T14:27:53.094Z","dependency_job_id":null,"html_url":"https://github.com/Pronovix/docker-drupal-dev","commit_stats":null,"previous_names":[],"tags_count":218,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pronovix%2Fdocker-drupal-dev","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pronovix%2Fdocker-drupal-dev/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pronovix%2Fdocker-drupal-dev/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pronovix%2Fdocker-drupal-dev/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pronovix","download_url":"https://codeload.github.com/Pronovix/docker-drupal-dev/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223902408,"owners_count":17222372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["behat","docker","drupal","phpunit","testing","wodby"],"created_at":"2024-11-10T01:27:01.716Z","updated_at":"2024-11-10T01:27:02.196Z","avatar_url":"https://github.com/Pronovix.png","language":"PHP","readme":"# Drupal development \u0026 testing environment\n\n\u003e **Warning! Inform the pods and the infra team about the changes you're about to make in this repository. Every change affects downstream projects, and our builds depend on it.**\n\nDocker based Drupal environment for local development and testing.\n\nSupported testing frameworks: PHPUnit, Behat\n\nIt is recommended to use in combination with the `pronovix/drupal-qa` Composer plugin.\n\n**Notice: Always pull a specific tag or commit from this repository! There could be breaking changes!**\n\n## Requirements\n\n- [Docker \u003e= 18.03](https://www.docker.com/get-docker)\n- [Docker Compose](https://docs.docker.com/compose/)\n\n## Usage\n\n```sh\n$ git clone https://github.com/Pronovix/docker-drupal-dev.git drupal-dev\n$ mkdir build;\n$ ln -s drupal-dev/docker-compose.yml\n$ ln -s drupal-dev/Dockerfile\n$ printf \"COMPOSE_PROJECT_NAME=[YOUR_PROJECT_NAME]\\n#You can find examples for available customization in the drupal-dev/examples/.env file.\\n\" \u003e .env \u0026\u0026 source .env\n$ docker compose up -d --build\n```\n\n**Replace [YOUR_PROJECT_NAME] with a string that only contains lowercase letters and dashes. It must not contain spaces\nor any special characters. Ex.: my_awesome_project**\n\n## Installing Drupal 8 inside the running PHP container\n\n```sh\n$ docker compose exec php composer create-project drupal-composer/drupal-project:8.x-dev ../build -n\n```\n\nNow continue with an _optional_, but highly recommended step. Symlink `settings*.php` files and `development.services.yml.dist`\nfrom the `drupal` folder to `build/web/sites`. Symlink `settings*.php` files and `development.services.yml.dist` from\nthe `drupal` folder to `build/web/sites`. **Symlinks must be relative to the destination path in a way that they could\nbe accessed inside the `php` container as well.**\n\n```sh\n$ ln -s ../../../../drupal-dev/drupal/settings.php build/web/sites/default/settings.php\n$ ln -s ../../../../drupal-dev/drupal/settings.shared.php build/web/sites/default/settings.shared.php\n$ ln -s ../../../../drupal-dev/drupal/settings.testing.php build/web/sites/default/settings.testing.php\n$ ln -s ../../../drupal-dev/drupal/development.services.yml.dist build/web/sites/development.services.yml.dist\n```\n\n(If `settings.php` file already exists then delete it or rename it to `settings.local.php`.)\n\nIf you successfully symlinked these files then your environment is ready to be used. You can install the site on the UI\nor with Drush.\n\nYou can install the site with the minimal install profile like this with Drush: `docker compose exec php drush si minimal -y`.\nIf the `build/config` folder does not exist you have to add `--db-url=$SIMPLETEST_DB` to the end of the command because\nDrush is not going to read the configuration from the symlinked settings.php. (This is probably a bug.)\n\n## Accessing to the dev environment inside a browser\n\nCheck the _current_ port of the running webserver container with `docker compose ps webserver`:\n\n```sh\n              Name                            Command               State           Ports\n--------------------------------------------------------------------------------------------------\n       my_module_webserver           /docker-entrypoint.sh sudo ...   Up      0.0.0.0:32794-\u003e80/tcp\n```\n\n**Note: The exposed port changes every time when the `webserver` container restarts.**\n\nIf you generate a login URL with Drush then replace the `webserver` in the login url with `localhost:[PORT]`, like: http:/localhost:32794/user/reset/1/1561455114/sKYjEf26WZ6bzuh-KrNY425_3KCppiCHI8SxKZ158Lw/login.\n\n## Running tests\n\n### PHPUnit\n\nIn this configuration everything is preconfigured for running any Drupal 8's PHPUnit tests, included but not limited to\nPHPUnit Javascript tests. If you have PHPUnit installed as a Composer dependency in your project, then running PHPUnit\ntests is simple, here is a few examples:\n\n```sh\n$ docker compose run --rm php ./vendor/bin/phpunit -c web/core -v --debug --printer '\\Drupal\\Tests\\Listeners\\HtmlOutputPrinter' web/core/modules/node # Run all tests of the node module.\n$ docker compose run --rm php ./vendor/bin/phpunit -c web/core -v --debug --printer 'Drupal\\Tests\\Listeners\\HtmlOutputPrinter' web/core/modules/node/tests/src/Functional/NodeCreationTest.php # Run one specific test from the node module.\n$ docker compose run --rm php ./vendor/bin/phpunit -c web/core -v --debug --printer '\\Drupal\\Tests\\Listeners\\HtmlOutputPrinter' --testsuite kernel # Run all kernel tests.\n```\n\nYou can find more information about available PHPUnit CLI parameters and configuration options in the official [PHPUnit\ndocumentation](https://phpunit.de/manual/6.5/en).\n\n### Behat\n\n`docker-compose.yml` contains some sane default Behat settings that make it possible to run Behat tests\ninside the PHP container smoothly. Check `BEHAT_PARAMS` environment variable in the definition of the `php` container.\n\n## Usage\n\n1. Copy the `behat.yml.dist` file to the `build` folder with `cp drupal-dev/examples/behat/behat.yml.dist build/behat.yml.dist`.\nYou can also add your `behat.yml` with overrides to this directory if you have one.\n2. For demonstration purposes copy the `drupal-dev/examples/behat/login.feature` to `build/behat` with `mkdir build/behat \u0026\u0026 cp drupal-dev/examples/behat/login.feature build/behat`.\n3. Make sure the site is in an installed state. You can ensure that by importing a database or installing a site\nmanually of with Config Installer.\n4. Run all Behat tests from the `build/behat` folder: `docker compose exec php php vendor/bin/behat`.\n\nYou can find more information about available Behat CLI parameters and configuration options in the official [Behat](https://docs.behat.org)\nand [Drupal Behat extension](https://behat-drupal-extension.readthedocs.io/) documentation.\n\n### Notes\n\nIt is recommended to install the `pronovix/drupal-qa` package with Composer because it ships a bunch of useful Behat\nextensions that could make your life easier when you are testing a site.\n\n## Checking outgoing emails\n\nMailHog captures all outgoing emails from this development environment. (Unless you override the default mail system\nconfiguration in Drupal.)\n\nIf you would like to review all sent emails then check the local port of the `mailhog` container with `docker compose ps mailhog`:\n\n```sh\n             Name             Command   State                 Ports\n----------------------------------------------------------------------------------\n      my_module_mailhog       MailHog     Up      1025/tcp, 0.0.0.0:32772-\u003e8025/tcp\n```\n\nand open the MailHog admin UI in your browser, e.g., `http://localhost:32772`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpronovix%2Fdocker-drupal-dev","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpronovix%2Fdocker-drupal-dev","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpronovix%2Fdocker-drupal-dev/lists"}