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 Answers 3

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.

1
  • Thanks, that's the solution I ended up using, just wanted to make sure I wasn't missing something. Commented Jan 1, 2014 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.

0
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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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