php-mock/php-mock-phpunit

Better to move phpunit/phpunit into require-dev

ouyangde opened this issue · 4 comments

Better to move phpunit/phpunit into require-dev

May I ask why?

require-dev:

Lists packages required for developing this package, or running tests, etc.

For php-mock-phpunit PHPUnit is more than that. It's a hard dependency.

Where do you see the benefit in having it in require-dev?

Yes, it actually makes no diffrences. For every normal packages, they have phpunit in require-dev, so why move it into require? (Notice that there is no diffrences in use.)

There is another scene: Suppose that I already have phpunit installed as cli-tools, then the require for phpunit/phpunit is redundant. If had it removed, I can require php-mock-phpunit, then composer install weil run more quickly then before and unittest can still be performed.

Yes, it actually makes no diffrences.

It does. If one for what ever reason would not specify phpunit as dependency php-mock-phpunit would appear broken. More over php-mock-phpunit is not compatible with every phpunit version. If someone has let's say a dependency to phpunit-3 and wants to require php-mock-phpunit, composer will clearly say what's wrong. This will not happen if phpunit is a require-dev dependency of php-mock-phpunit.

Suppose that I already have phpunit installed as cli-tools

It's not a good practice to suppose such things. If you want to manage your dependencies your self, don't use composer.

Yes, it actually makes no diffrences.

I mean, if I always require-dev php-mock-phpunit, (maybe this is a good practice,) it makes no diffrences whether php-mock-phpunit require or require-dev phpunit/phpunit. When I run composer install --dev, both of them will be installed, when composer install --no-dev, none of them will be installed.