Allow using ci-phpunit-test directly from vendor path - #274
Conversation
This avoids having to clutter an application's directory with a copy of ci-phpunit-test. See comments under kenjis#171.
Exclude from code coverage: This is test suite bootstrap code, so we know it's executed, but because it's bootstrap code, it runs outside of any coverage tracking.
|
I updated the PR to fix a couple of bugs and to keep the code coverage from decreasing (as requested by CONTRIBUTING.md). I improved the code coverage by perhaps cheating: I had to add additional path handling to If you'd prefer that it instead remained tracked (as a reminder/placeholder to perhaps someday test it with mocking) and prefer that I find some other way to improve coverage, please let me know. |
|
I think it is a problem that can be solved by using a symbolic link, but what kind of benefits can the user get? $ cd application/tests
$ rm -rf _ci_phpunit_test
$ ln -s ../../vendor/kenjis/ci-phpunit-test/application/tests/_ci_phpunit_test/ . |
|
@ytetsuro The biggest benefit would be getting third-party code out of a project's repository - that makes it easier to separate the developers' own code from third-party dependencies, keeps the repo smaller, etc. It may also make upgrading to a new version of ci-phpunit-repo easier. I hadn't thought about using symlinks; thank you for the suggestion. However, it would be nice to have an officially supported solution, and symlinks are not straightforward to enable and use for Windows developers. |
Updating a working copy from a local installation of ci-phpunit-test to the Composer-ized one may leave a local, mostly empty _ci_phpunit_test directory. Checking for the actual file is more reliable.
Allow using ci-phpunit-test directly from vendor path
This avoids having to clutter an application's directory with a copy of ci-phpunit-test.
To implement this, I added a
CI_PHPUNIT_TESTPATHPHP constant that gives the location of ci-phpunit-test. It defaults to usingapplication/tests/_ci_phpunit_testif that's present (so the default behavior is the same as previous versions. However, if that directory isn't present, then it looks for avendorfolder next to theapplicationfolder.Is this general approach okay? If so, I can update this PR to update documentation and (if appropriate) to update the Composer version of the installer script.
See these comments under #171.
Thanks!