4

I want to reuse test code (e.g. mock classes) from a package. But i don't know how to tell composer to fetch the dependency with tests included.

My composer.json:

"require": {
   "some/package": "2.0.0"
}

composer.json of the other package (which has /src and /tests subfolders):

"autoload": {
    "psr-4": {
      "Some\\Namespace\\": "src/"
    }
},
"autoload-dev": {
    "psr-4": {
      "Some\\Namespace\\Tests\\": "tests/"
    }
},

This gives me only the /src folder under /vendor/some/package/.

I tried specifiying some/package: 2.0.0@dev without any effect.

Is this even possible with composer (and packagist)?

Sloothword
  • 349
  • 1
  • 10

1 Answers1

-1

Use require-dev this will then also install the the development packages when composer install is run.

"require-dev": { "phpunit/phpunit": "3.7.*", "mockery/mockery": "0.7.*" },

As described here https://stackoverflow.com/a/19120691/409556

Community
  • 1
  • 1
hayres
  • 120
  • 1
  • 11
  • 1
    If i include `mockery/mockery` into `require-dev` it does not install the `require-dev` dependencies from the `composer.json` included in `mockery` – Sloothword Nov 26 '16 at 15:10