Running tests of a composer package in vendor directory

Viewed 2978

I have a project I created with composer create-project command, but before running composer install, I added one more package to project composer.json file. After installing the packages, I correctly have all the dependencies including the one newly added in the vendor directory. What I want now is to run the tests of the package that I manually added to composer.json. I tried the below, but doesn't seem to run the tests of the said package

./vendor/bin/phpunit 
1 Answers

I was having a similar problem, we have separate private packages in vendor folder that needed to be tested. By default composer autoload-dev includes only root package as mentioned here https://getcomposer.org/doc/04-schema.md#root-package

To include your forked package just add an entry in your root composer.json file under autoload-dev

"autoload-dev": {
        "psr-4": {
            "Company\\Package\\Tests\\": "vendor/package/tests/"
        }
    },
Related