0

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?

edigu
  • 9,878
  • 5
  • 57
  • 80
Ibrahim Azhar Armar
  • 25,288
  • 35
  • 131
  • 207

2 Answers2

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.

Falc
  • 595
  • 1
  • 5
  • 15
1

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:

  1. 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! :)
  2. Please try to NOT use the PEAR distribution channels of PHPUnit or Symfony anymore. These will be turned off in a while,
Sven
  • 69,403
  • 10
  • 107
  • 109
  • Thanks, i could find the fix for "Zend_Test_PHPUnit_ControllerTestCase" to make it compatible with PHPUnit 4.0. – Ibrahim Azhar Armar Dec 30 '14 at 09:49
  • @IbrahimAzharArmar DID you find a fix for `Zend_Test_PHPUnit_ControllerTestCase` that made it compatible with a new version of PHPUnit? If so, can you share with the rest of us please? – dKen Nov 07 '15 at 09:07
  • 1
    @IbrahimAzharArmar Thanks mate! Turns out that the more recent versions of ZF1 (1.12.7+) were updated to support more recent versions of PHPUnit than 3.4. I'm using 4.1 and that seems to work as well. For others who find this post, you can [read more here](http://stackoverflow.com/a/26509385/366529). – dKen Nov 07 '15 at 12:04