简体   繁体   中英

Running tests of a composer package in vendor directory

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 

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/"
        }
    },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM