Repository navigation
Add Composer consumer-project end-to-end tests - #8
Open
DaveLiddament wants to merge 2 commits into
Open
DaveLiddament wants to merge 2 commits into
DaveLiddament wants to merge 2 commits into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an end-to-end test that installs the extension into real consumer projects through Composer, then runs their PHPStan with
--error-format=jsonand compares the exact output: twoeffects.violationerrors, 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.neonincludesvendor/dave-liddament/phpstan-effect-system/extension.neon.extension-installer:phpstan/extension-installerregisters it fromextra.phpstanin this package'scomposer.json.Each project requires the package from a path repository pointing at the checkout, and each test run starts from a clean
vendor/andcomposer.lock.It needs
composerand network access, so it's a separatecomposer-projectsuite (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.phpstanfails only the extension-installer project. A wrong PSR-4 path or an unregistered rule inextension.neonfails both.