Closed mad-briller closed 1 year ago
Would be nice to add another job here https://github.com/phpstan/extension-installer/blob/1.2.x/.github/workflows/integration-tests.yml to verify that the code works :)
And also update the README.
was wondering how to add a test for it tbh, do you have any advice for me? new to github actions and not sure where to begin
something like:
perhaps?
Anything to reproduce the actual scenario that ignore
would fix, without relying on any 3rd party repository.
1) Move the current contents of e2e/
into a subdirectory so that we can test more stuff in e2e/
.
2) Add a subdirectory with an "extension" that supports extension-installer, make a rule that always reports an error, or crashes PHPStan.
3) Add another subdirectory that requires the extension from 2) as a package, and also requires phpstan/extension-installer
, and contains the new ignore
setting to actually exclude the extension. And runs PHPStan on a piece of code to verify the extension was not loaded. I expect the composer.json in this directory to have two entries in repositories
, similar to https://github.com/phpstan/extension-installer/blob/3f3d1ba8417da188b606408dfc6722a5b420e80f/e2e/composer.json#L8-L16 - one for the extension from 2), one for extension-installer
.
thanks for the detailed steps, that helped alot
you can see here that it was ignored: https://github.com/phpstan/extension-installer/actions/runs/4732666346/jobs/8399123646?pr=70#step:4:30
Wow, it's great when someone listens and does everything correctly on the first try :) Thank you very much!
I'm gonna release this as 1.3.0.
This is useful when you don't want to auto-discover a particular phpstan extension, but still want the benefit of the extension installer for all other packages
for example when developing Drupal modules, it's common to include
drupal/core-dev
for testing or other purposes, howeverdrupal/core-dev
has a peer dependency onmgalman/phpstan-drupal
, which the extension installer then finds and installs as you'd expect.however, the
mgalman/phpstan-drupal
extension wants a full working copy of drupal, which is not available when running in a CI environment for a single module. ideally we want to ignore the installation of that extension but not at the cost of extension auto-discoverythanks for your time