elementor/bin
Svitlana-Dykun 0be0c2bc0d
Internal: Add local PHPUnit runner script [ED-24147] (#35931)
## PR Checklist
<!-- 
Please check if your PR fulfills the following requirements:
**Filling out the template is required.** Any pull request that does not
include enough information to be reviewed in a timely manner may be
closed at the maintainers' discretion.
 -->
- [ ] The commit message follows our guidelines:
https://github.com/elementor/elementor/blob/master/.github/CONTRIBUTING.md


## PR Type
What kind of change does this PR introduce?
<!-- Please check the one that applies to this PR using "x" with no
spaces eg: [x]. -->
- [ ] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## Summary

This PR can be summarized in the following changelog entry:

*

## Description
An explanation of what is done in this PR

*

## Test instructions
This PR can be tested by following these steps:

*

## Quality assurance

- [ ] I have tested this code to the best of my abilities
- [ ] I have added unittests to verify the code works as intended
- [ ] Docs have been added / updated (for bug fixes / features)

Fixes #

<!--start_gitstream_placeholder-->
###  PR Description
## 1. Problem & Context

Developers running PHPUnit locally need a streamlined setup that handles
MySQL container orchestration, WordPress test suite installation, and
test execution without manual dependency management.

## 2. What Changed (Where)

- **bin/phpunit-local.sh** — New 122-line bash script automating Docker
MySQL setup, container lifecycle, WP test suite installation, and
PHPUnit execution with optional test filtering
- **composer.json** — Added `phpunit:local` script alias pointing to the
new bash runner
- **docs/development/phpunit.md** — Replaced outdated manual setup
instructions with Docker-based workflow documentation including
version/filter examples
- **bin/install-wp-tests.sh** — Added `SKIP_INSTALL_DB` flag to allow
database recreation without reinstalling test suite

## 3. How It Works

Entry point: `composer run phpunit:local [--filter]` → checks Docker/SVN
availability → finds or creates MySQL container on port 3306 → waits for
MySQL readiness → cleans/reinstalls WP test suite via existing
`install-wp-tests.sh` (skipping DB init if `SKIP_INSTALL_DB` set) →
executes PHPUnit with optional filter or full test run.
Architecture-independent MySQL image selection (mysql:8.4 for arm64, 8.0
for others) handles Silicon Mac compatibility.

## 4. Risks

**Container port collision:** Script reuses any container on port 3306
regardless of credentials—could silently use wrong database if unrelated
containers exist. Mitigation: explicit error messaging if pings fail
with credential hints. **SVN requirement undocumented for Windows WSL
users:** script only provides Mac/Linux install hints.

_Generated by LinearB AI and added by gitStream._
<sub>AI-generated content may contain inaccuracies. Please verify before
using.
💡 **Tip:** You can customize your AI Description using **Guidelines**
[Learn
how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub>
<!--end_gitstream_placeholder-->

---------

Co-authored-by: ElementorBot <48412871+elementorbot@users.noreply.github.com>
2026-05-19 12:01:59 +02:00
..
bootstrap-env.sh Tests/unit/php/docker: Remove - removed unnecessary code 2018-12-11 11:14:19 +02:00
includes.sh Tests/unit/php/docker: New - Docs for 'is_windows()' 2018-12-11 11:15:27 +02:00
install-wp-tests-local.sh Internal: Allow activation of multiple experiments in a single CLI call [ED-10737] (#22441) 2023-05-16 22:47:31 +03:00
install-wp-tests.sh Internal: Add local PHPUnit runner script [ED-24147] (#35931) 2026-05-19 12:01:59 +02:00
phpunit-local.sh Internal: Add local PHPUnit runner script [ED-24147] (#35931) 2026-05-19 12:01:59 +02:00
uninstall.sh Tests/unit/php/docker: Change - update uninstall command 2018-12-11 11:14:52 +02:00