14

I'm working with an Enterprise Edition 1.13.1 install (although Community Edition would have the same issue), and we're installing dependencies via composer where they're available. I've installed Ivan's Ecomdev_PhpUnit extension via composer which has bought in all of the normal phpunit dependencies. I've also copied phpunit.xml.dist from vendor/ivanchepurnyi/ecomdev_phpunit into my projects root directory.

When I first ran my unit tests, I received the following error:

The test was skipped, since vfsStream component is not installed. Try install submodules required for this functionality

I've subsequently added the following require-dev entry to composer.json and run composer update:

"mikey179/vfsStream": ">=1.2.0",

However, PHPUnit still complains that vfsStream isn't installed.

Looking through the GitHub repository for the Ecomdev_PHPUnit extension it looks like a patch has been merged to allow libvsfstream to be autoloaded when composer is used. However, this seems like a partial solution as the composer autoloader isn't included anywhere, so the class_exists call still fails.

I can edit /vendor/ivanchepurnyi/ecomdev_phpunit/app/code/community/EcomDev/PHPUnit/bootstrap.php:41 to include the composer autoloader during the bootstrap (or copy the bootstrap.php to another location in my project and edit that). Is this the best solution to this problem, or is there a feature in either Composer or Ecomdev_PhpUnit that I'm missing?

3

editing the bootstrap is the correct solution here, as the bootstrap belongs to your own project scope.
The one ecomdev delivers is only an example/default one, which is oriented on the classical non composer installations.

  • Thanks, that's the solution I ended up using, just wanted to make sure I wasn't missing something. – Jim OHalloran Jan 1 '14 at 22:16
4

Other fix for this is to use the autoloader: https://github.com/magento-hackathon/Magento-PSR-0-Autoloader this means you dont have to edit the bootstrap file.

  • +1 Although I ended up editing bootstrap.php to solve my problem, this is probably the better solution. – Jim OHalloran Mar 6 '14 at 22:17
2

I know that this might be a little bit late, but simply download vfsStream from GitHub and copy/pasting the content to lib/vfsStream may solve your problem.

https://github.com/mikey179/vfsStream

  • The issue isn't that vfsStream isn't installed (it is), it's that it can't be autoloaded. – Jim OHalloran Nov 26 '14 at 4:46
  • But I had the exactly same problem(composer didn't helped) and just did the solution I wrote and it solved. – Michel Gokan Nov 27 '14 at 7:28
  • @MichelGokan, your solution worked fine for me too. Thx. – DarkCowboy Apr 1 '16 at 13:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.