Phpunit: PHPUnit 3.7 composer install fails with phpunit-mock-objects package.

Created on 18 May 2014  路  15Comments  路  Source: sebastianbergmann/phpunit

In the light of #1229 I wanted to give PHPUnit 3.7 install via composer a shot.

PHPUnit 3.7 requires PHP 5.3.3 (I have PHP 5.4.13)

I followed the instructions on http://phpunit.de/manual/3.7/en/installation.html.

I created the minimal composer.json file.

I executed composer install which failed:

$ composer install
Warning: This development build of composer is over 30 days old. It is recommended to update it by running "c:/Dokumente und Einstel
lungen/mot/Lokale Einstellungen/Anwendungsdaten/Programs/Composer/bin/composer.phar self-update" to get the latest version.
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing symfony/yaml (v2.4.4)
    Downloading: 100%

  - Installing phpunit/php-text-template (1.2.0)
    Loading from cache

  - Installing phpunit/phpunit-mock-objects (1.2.3)
    Loading from cache



  [ErrorException]
  ZipArchive::extractTo(vendor/composer/8bc5af00/sebastianbergmann-phpunit-mock-objects-5794e3c\Tests\MockObject/namespaced_class
  _implementing_interface_dont_call_parent_constructor.phpt): failed to open stream: No such file or directory



install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--n
o-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]

I then continued with the self-update and did a re-run:

$ composer self-update
Updating to version 0c343f925ad578a9da4d9a4cfff4e91b500d206c.
    Downloading: 100%

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing phpunit/phpunit-mock-objects (1.2.3)
    Downloading: 100%



  [ErrorException]
  ZipArchive::extractTo(vendor/composer/782095c0/sebastianbergmann-phpunit-mock-objects-5794e3c\Tests\MockObject/namespaced_class
  _implementing_interface_dont_call_parent_constructor.phpt): failed to open stream: No such file or directory



install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--n
o-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

So the installation does fail because ZipArchive gives an error exception in the phpunit-mock-objects package. Please fix that package.

Most helpful comment

Maybe the path is too long for Windows.

All 15 comments

I can't reproduce this.

@hakre Would you mind providing some information about your environment?

The two other versions available for installation via composer - "phpunit/phpunit": "4.0.*" and "phpunit/phpunit": "4.1.*" - do fail as well with the same exception.

I can reproduce this always. Using Windows XP SP 3 with git bash.

Can you install other composer packages?

I normally have no problem to use composer. It's this Mock objects one. E.g. the other packages do install well (from the 4.0.* run):

$ composer install
Loading composer repositories with package information
Installing dependencies (including require-dev)
  - Installing sebastian/version (1.0.3)
    Downloading: 100%

  - Installing sebastian/exporter (1.0.1)
    Downloading: 100%

  - Installing sebastian/environment (1.0.0)
    Downloading: 100%

  - Installing sebastian/diff (1.1.0)
    Downloading: 100%

  - Installing phpunit/phpunit-mock-objects (2.0.5)
    Downloading: 100%



  [ErrorException]
  ZipArchive::extractTo(vendor/composer/e7b526a0/sebastianbergmann-phpunit-mock-objects-3697daa\tests\MockObject/namespaced_class
  _implementing_interface_dont_call_parent_constructor.phpt): failed to open stream: No such file or directory



install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--n
o-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [packages1] ... [packagesN]

In vendor\phpunit\phpunit-mock-objects\ a zip-file named f599b779ae16b07605a63476b9ff3614 is left over. Should I extract it there manually so I at least am able to do a manual override?

_Update:_ Just extracting doesn't work for manual overriding.

Maybe the path is too long for Windows.

I'm not really sure what the best course of action is here. Maybe @Seldaek can help us.

193 for the relative one and (which I guess ist more importantly) 293 for the full path. That would be 291 characters after the colon which is larger than MAX_PATH of 260 from Windows API :/

Are you able to install PHPUnit at a shorter path? I guess we could shorten up the filename a bit if we can confirm that the length is the issue.

Running the same install in a short directory like d:\a, it just does it well. I tested it. However if d:\a is a junction point to the other directory that is large, it still fails. So I can not use junction points to work around this

My current idea is that I first install it in the shorter path and then move compser + vendor over in the larger one. _Update:_ This did work. Not nice, but a workaround. Can live with that on XP.

@whatthejeff: Just a question, which PHPUnit version should I target? This is a more or less widely used project. OK to go with 4.1.* ? (and thanks for you support trouble.shooting this together)

Yep, 4.1.* is the current stable release.

Just FYI I hear PHP 5.6 should resolve the long path support on windows, but I suppose it doesn't support windows xp anymore so maybe it's time you upgrade everything soon ;)

Awesome. Thanks for the feedback @Seldaek :)

Was this page helpful?
0 / 5 - 0 ratings