{"id":16355411,"url":"https://github.com/alexskrypnyk/testmode","last_synced_at":"2026-04-11T08:07:30.378Z","repository":{"id":42742827,"uuid":"196482481","full_name":"AlexSkrypnyk/testmode","owner":"AlexSkrypnyk","description":"💧 Drupal module used to alter existing site content and other configurations when running tests.","archived":false,"fork":false,"pushed_at":"2024-11-27T08:40:27.000Z","size":111,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"2.x","last_synced_at":"2025-02-08T00:59:33.143Z","etag":null,"topics":["behat","drupal","testing"],"latest_commit_sha":null,"homepage":"https://www.drupal.org/project/testmode","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlexSkrypnyk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"patreon":"alexskrypnyk"}},"created_at":"2019-07-12T00:37:59.000Z","updated_at":"2024-11-27T08:39:57.000Z","dependencies_parsed_at":"2023-12-15T09:30:41.188Z","dependency_job_id":"a615bf72-935d-4b76-a282-0c389393debd","html_url":"https://github.com/AlexSkrypnyk/testmode","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexSkrypnyk%2Ftestmode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexSkrypnyk%2Ftestmode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexSkrypnyk%2Ftestmode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlexSkrypnyk%2Ftestmode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlexSkrypnyk","download_url":"https://codeload.github.com/AlexSkrypnyk/testmode/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238254112,"owners_count":19441788,"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","drupal","testing"],"created_at":"2024-10-11T01:40:48.386Z","updated_at":"2026-04-11T08:07:30.366Z","avatar_url":"https://github.com/AlexSkrypnyk.png","language":"PHP","funding_links":["https://patreon.com/alexskrypnyk"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"\" rel=\"noopener\"\u003e\n  \u003cimg width=200px height=200px src=\"https://placehold.jp/000000/ffffff/200x200.png?text=Testmode\u0026css=%7B%22border-radius%22%3A%22%20100px%22%7D\" alt=\"Testmode logo\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch1 align=\"center\"\u003eDrupal module to modify existing site content and configurations while running tests.\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![GitHub Issues](https://img.shields.io/github/issues/AlexSkrypnyk/testmode.svg)](https://github.com/AlexSkrypnyk/testmode/issues)\n[![GitHub Pull Requests](https://img.shields.io/github/issues-pr/AlexSkrypnyk/testmode.svg)](https://github.com/AlexSkrypnyk/testmode/pulls)\n[![Test](https://github.com/AlexSkrypnyk/testmode/actions/workflows/test.yml/badge.svg)](https://github.com/AlexSkrypnyk/testmode/actions/workflows/test.yml)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/AlexSkrypnyk/testmode)\n![LICENSE](https://img.shields.io/github/license/AlexSkrypnyk/testmode)\n![Renovate](https://img.shields.io/badge/renovate-enabled-green?logo=renovatebot)\n\n![PHP 8.2](https://img.shields.io/badge/PHP-8.2-777BB4.svg)\n![PHP 8.3](https://img.shields.io/badge/PHP-8.3-777BB4.svg)\n![PHP 8.4](https://img.shields.io/badge/PHP-8.4-777BB4.svg)\n![Drupal 10](https://img.shields.io/badge/Drupal-10-009CDE.svg)\n![Drupal 11](https://img.shields.io/badge/Drupal-11-006AA9.svg)\n\n\u003c/div\u003e\n\n---\n\nThis is a module to support testing, so it is not expected to be used in production (although, it adheres to Drupal coding standards and has good test coverage).\n\n## Installation\n\n```shell\ncomposer require --dev drupal/testmode\n```\n\n## Use case\n\nRunning a Behat test on the site with existing content may result in\nfalse-positives because of the live content being mixed with the test content.\n\nExample: list of 3 featured articles. When the test creates 3 articles and makes\nthem featured, there may be existing featured articles that will confuse tests\nresulting in a false-positive failure.\n\n## How it works\n1. When writing Behat tests, all test content items (nodes,\n   terms, users) follow specific pattern. For example, node titles start with\n   `[TEST] `.\n2. A machine name of a view, which needs to be tested, is added to\n   Testmode configuration form.\n3. Behat test tagged with `@testmode` will put\n   the site in test mode that will filter-out all items in the view that do not\n   fit the pattern, leaving only content items created by the test.\n\n## Maintenance / Development\nReleases in GitHub are automatically pushed to http://drupal.org/project/testmode by CI.\n\n## Issues\nhttps://www.drupal.org/project/issues/testmode\n\n## Local development\n\n1. Install PHP with SQLite support and Composer\n3. Clone this repository\n4. Run `ahoy build`\n\n## Building website\n\n`ahoy build` assembles the codebase, starts the PHP server\nand provisions the Drupal website with this extension enabled. These operations\nare executed using scripts within [`.devtools`](.devtools) directory. CI uses\nthe same scripts to build and test this extension.\n\nThe resulting codebase is then placed in the `build` directory. The extension\nfiles are symlinked into the Drupal site structure.\n\nThe `build` command is a wrapper for more granular commands:\n```bash\nahoy assemble     # Assemble the codebase\nahoy start        # Start the PHP server\nahoy provision    # Provision the Drupal website\n```\n\nThe `provision` command is useful for re-installing the Drupal website without\nre-assembling the codebase.\n\n### Drupal versions\n\nThe Drupal version used for the codebase assembly is determined by the\n`DRUPAL_VERSION` variable and defaults to the latest stable version.\n\nYou can specify a different version by setting the `DRUPAL_VERSION` environment\nvariable before running the `ahoy build` command:\n\n```bash\nDRUPAL_VERSION=11 ahoy build        # Drupal 11\nDRUPAL_VERSION=11@alpha ahoy build  # Drupal 11 alpha\nDRUPAL_VERSION=10@beta ahoy build   # Drupal 10 beta\nDRUPAL_VERSION=11.1 ahoy build      # Drupal 11.1\n```\n\nThe `minimum-stability` setting in the `composer.json` file is\nautomatically adjusted to match the specified Drupal version's stability.\n\n### Using Drupal project fork\n\nIf you want to use a custom fork of `drupal-composer/drupal-project`, set the\n`DRUPAL_PROJECT_REPO` environment variable before running the `ahoy build`\ncommand:\n\n```bash\nDRUPAL_PROJECT_REPO=https://github.com/me/drupal-project-fork.git ahoy build\n```\n\n### Patching dependencies\n\nTo apply patches to the dependencies, add a patch to the `patches` section of\n`composer.json`. Local patches are be sourced from the `patches` directory.\n\n### Providing `GITHUB_TOKEN`\n\nTo overcome GitHub API rate limits, you may provide a `GITHUB_TOKEN` environment\nvariable with a personal access token.\n\n### Provisioning the website\n\nThe `provision` command installs the Drupal website from the `standard`\nprofile with the extension (and any `suggest`'ed extensions) enabled. The\nprofile can be changed by setting the `DRUPAL_PROFILE` environment variable.\n\nThe website will be available at http://localhost:8000. The hostname and port\ncan be changed by setting the `WEBSERVER_HOST` and `WEBSERVER_PORT` environment\nvariables.\n\nAn SQLite database is created in `/tmp/site_testmode.sqlite` file.\nYou can browse the contents of the created SQLite database using\n[DB Browser for SQLite](https://sqlitebrowser.org/).\n\nA one-time login link will be printed to the console.\n\n## Coding standards\n\nThe `ahoy lint` command checks the codebase using multiple tools:\n- PHP code standards checking against `Drupal` and `DrupalPractice` standards.\n- PHP code static analysis with PHPStan.\n- PHP deprecated code analysis and auto-fixing with Drupal Rector.\n- Twig code analysis with Twig CS Fixer.\n\nThe configuration files for these tools are located in the root of the codebase.\n\n### Fixing coding standards issues\n\nTo fix coding standards issues automatically, run `ahoy lint-fix`. This runs\nthe same tools as `lint` command but with the `--fix` option (for the tools\nthat support it).\n\n## Testing\n\nThe `ahoy test` command runs the PHPUnit tests for this extension.\n\nThe tests are located in the `tests/src` directory. The `phpunit.xml` file\nconfigures PHPUnit to run the tests. It uses Drupal core's bootstrap file\n`core/tests/bootstrap.php` to bootstrap the Drupal environment before running\nthe tests.\n\nThe `test` command is a wrapper for multiple test commands:\n```bash\nahoy test-unit        # Run Unit tests\nahoy test-kernel      # Run Kernel tests\nahoy test-functional  # Run Functional tests\n```\n\n### Running specific tests\n\nYou can run specific tests by passing a path to the test file or PHPUnit CLI\noption (`--filter`, `--group`, etc.) to the `ahoy test` command:\n\n```bash\nahoy test-unit tests/src/Unit/MyUnitTest.php\nahoy test-unit -- --group=wip\n```\n\nYou may also run tests using the `phpunit` command directly:\n\n```bash\ncd build\nphp -d pcov.directory=.. vendor/bin/phpunit tests/src/Unit/MyUnitTest.php\nphp -d pcov.directory=.. vendor/bin/phpunit --group=wip\n```\n\n---\n_This repository was created using the [Drupal Extension Scaffold](https://github.com/AlexSkrypnyk/drupal_extension_scaffold) project template_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexskrypnyk%2Ftestmode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexskrypnyk%2Ftestmode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexskrypnyk%2Ftestmode/lists"}