Development¶
This guide explains how to run the test suite, build the documentation, and navigate friendsofmago/mago-mockery.
Run the test suite¶
Install development dependencies and run all checks:
composer install
php tests/check-spec.php
composer test
composer test runs two suites in order:
php tests/run.phprunstests/check-providers.php,tests/check-docs.php,mago extension validate, and fixture analysis in default,--no-extensions, andMAGO_MOCKERY_STRICT_METHODS=1modes.vendor/bin/phpunit tests/runtimeruns PHPUnit runtime contract tests against real Mockery 1.6 behavior andDocsTest.
If you use just, run just check-ci to run Composer validation, PHP syntax checks, spec checks, both test suites, and a strict docs build. Set MAGO_BIN=/path/to/mago to test against a different Mago binary.
Run self-analysis and corpus checks¶
Run Mago's analyzer against src/, bin/, and resources/ and compare against the committed baseline:
vendor/bin/mago --config mago-self.toml analyze --reporting-format=json > .mago-self-report.json || true
php tools/self-analyze-gate.php .mago-self-report.json
Run pinned open-source corpus checks against Mockery and Laravel test suites:
php tools/corpus-run.php --check
php tools/corpus-run.php --strict-methods
php tools/corpus-run.php --update-baseline
Run local benchmarks and refresh spec source hashes:
php bench/run-local.php --iterations=10000 --runs=5
php spec/harvest.php
Build and preview the docs¶
The documentation lives in docs/ and builds with Zensical from zensical.toml.
Serve the site locally with live reload on http://127.0.0.1:8000:
just docs
Build the site into site/ and fail on broken links or anchors:
just docs-build
Both commands install the Zensical version pinned in Justfile into .venv/.
tests/DocsCheck.php runs through both tests/check-docs.php and tests/runtime/DocsTest.php and checks three invariants in CI:
- Every diagnostic code in
src/has a heading indocs/analyzer/diagnostics.md, anddocs/analyzer/diagnostics.mdlists no stale plugin diagnostic codes. - Every
.mdfile underdocs/appears inzensical.tomlnavand in[project.plugins.llmstxt.sections]in the same order. - Every internal Markdown link and heading anchor inside
docs/resolves to an existing file and heading.
Source layout¶
src/MockeryExtension.phpexposes the public entry pointsMockeryExtension::create()andMockeryExtension::plugins().src/Analyzer/MockeryPlugin.phpregisters the mainmockeryplugin, its providers, PHPUnit initializers, entry points, trait constant issue filter, and opt-in strict hooks.src/Analyzer/NamedFetchMockPlugin.phpregisters themockery-named-fetchplugin for span-dependentfetchMock()resolution.src/Analyzer/Providers/holds all return type providers, callable signature overrides, strict-mode hooks, named-mock indexing, and trait constant flow analysis classes.resources/worker.phpandbin/mago-mockery-workerimplement the bundled extension host worker.tests/fixtures/,tests/phpunit-fixtures/,tests/mockery-1612-fixtures/, andtests/strict-fixtures/contain analyzer fixtures thattests/run.phpverifies.tests/runtime/contains PHPUnit tests that verify Mockery 1.6 runtime contracts and documentation invariants.