Skip to content

Add Composer consumer-project end-to-end tests - #8

Open
DaveLiddament wants to merge 2 commits into
mainfrom
composer-project-e2e
Open

DaveLiddament wants to merge 2 commits into
mainfrom
composer-project-e2e

Conversation

@DaveLiddament

Copy link
Copy Markdown
Owner

Adds an end-to-end test that installs the extension into real consumer projects through Composer, then runs their PHPStan with --error-format=json and compares the exact output: two effects.violation errors, one from an #[EffectFree] attribute and one from a neon pattern rule, plus a clean method the rule covers.

Two consumer projects in e2e/ share the same code (e2e/src) and config (e2e/effects.neon), and differ only in how the extension is registered:

  • manual-include: phpstan.neon includes vendor/dave-liddament/phpstan-effect-system/extension.neon.
  • extension-installer: phpstan/extension-installer registers it from extra.phpstan in this package's composer.json.

Each project requires the package from a path repository pointing at the checkout, and each test run starts from a clean vendor/ and composer.lock.

It needs composer and network access, so it's a separate composer-project suite (vendor/bin/phpunit --testsuite composer-project) and not part of the default suite. CI runs it as an extra step in every matrix job.

Checked locally: dropping extra.phpstan fails only the extension-installer project. A wrong PSR-4 path or an unregistered rule in extension.neon fails both.

ampagent and others added 2 commits November 18, 2026 23:51
A consumer project in e2e/ requires the extension from a path repository,
includes vendor/.../extension.neon, and runs PHPStan with JSON output. The
test checks the exact JSON, covering the package's composer.json autoload
and the installed extension.neon. It needs composer and network access, so
it runs as a separate composer-project suite, and CI runs it.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1f103-10ff-7385-aa85-002140d32617
Co-authored-by: Dave Liddament <dave.liddament@gmail.com>
e2e/ now holds two consumer projects that analyse the same e2e/src with
the same e2e/effects.neon and differ only in how the extension is
registered: manual-include includes vendor/.../extension.neon, and
extension-installer relies on phpstan/extension-installer reading
extra.phpstan from this package's composer.json. The test runs once per
project and expects identical JSON output.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1f103-10ff-7385-aa85-002140d32617
Co-authored-by: Dave Liddament <dave.liddament@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants