felixarntz / wordpressdev

WordPress core development environment based on Lando.
GNU General Public License v2.0
13 stars 0 forks source link

Install PHPUnit sources for IDEs to use for static analysis #16

Open westonruter opened 5 years ago

westonruter commented 5 years ago

Related to #10.

I opened PHPUnit test files in a plugin and my IDE complained about methods like assertEquals not being recognized. This is because PHPUnit's sources aren't loaded as part of core, due to different versions of PHPUnit being needed based on the version of PHP being tested on Travis.

Ideally, however, PHPUnit would be installed as part of core's composer.json. In lieu of this, I could get the same effect by doing:

cd public/core-dev
lando composer require "phpunit/phpunit:^6"
git checkout composer.*

That leaves the PHPUnit sources as orphaned dependencies.

Maybe we should rather have PHPUnit required by a composer.json in the entire Lando project? This would be an alternative then to doing:

https://github.com/felixarntz/wordpressdev/blob/f299483db09f6f5c38f299623c0fe34812875095/.lando.yml#L15-L16

We'd need to update the phpunit command to run $LANDO_MOUNT/vendor/bin/phpunit.

felixarntz commented 5 years ago

Which root directory do you run your IDE from? The repository root, the public directory, the core-dev directory? Just wondering whether this matters for from which location we run Composer.

I like the idea of having a central composer.json file, but I wanna make sure we don't fix the problem for only one specific use-case.

westonruter commented 5 years ago

I have wordpressdev as the project directory. So I have the .lando.yml in the root of my editor's directory tree.