Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top