问题
I am working with ZendFramework 1.x & 2.x
, unfortunately ZendFramework 1.x
supports only PHPUnit 3.x
& Zend Framework 2.x
requires PHPUnit 4.x
For this i want to install 2 versions of PHPUnit, here is the composer.json file i tried.
{
"repositories": [{
"type": "pear",
"url": "http://pear.symfony-project.com"
},{
"type": "pear",
"url": "http://pear.phpunit.de"
}],
"require-dev": {
"pear-pear.phpunit.de/PHPUnit": "3.4.*",
"phpunit/phpunit": "*"
}
}
I am getting following message.
Skipped installation of bin phpunit for package phpunit/phpunit: name conflicts with an existing file
Is there anyway that i can tell composer to use different names when installing in vendor/bin
directory? for instance "pear-pear.phpunit.de/PHPUnit": "3.4.*"
uses vendor/bin/pu34
& "phpunit/phpunit": "*"
uses vendor/bin/pu
is it possible to do this in composer?
回答1:
Composer does not support installing multiple versions of the same package.
The only thing you could do is install one (or both of them) as phar. But then they will not be defined in the composer.json
.
回答2:
I would challenge the assumption that Zend Framework 1 does only support PHPUnit 3.x.
The changes I saw between 3.7 and 4.0 were not really bc-breaking in the area you usually work in, i.e. PHPUnit_Framework_TestCase
. What has changed is the whole stuff of listeners etc. that has to react to the new notion of "risky test" now, but I am not aware of any to be used by Zend Framework.
I'd say two things:
- It isn't Zend Framework that supports PHPUnit in a version, it should be YOU. You are responsible to write tests, and in case of an application being migrated from ZF1 to ZF2, you should also migrate the test integration. If that means to change the
Zend_Test_PHPUnit_ControllerTestCase
to make it work with PHPUnit 4, then go for it! :) - Please try to NOT use the PEAR distribution channels of PHPUnit or Symfony anymore. These will be turned off in a while,
来源:https://stackoverflow.com/questions/27090705/install-multiple-version-of-phpunit-via-composer