Download the PHP package ecomdev/phpspec-magento-di-adapter without Composer
On this page you can find all versions of the php package ecomdev/phpspec-magento-di-adapter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package phpspec-magento-di-adapter
PHPSpec Magento 2.0 DI Adapter
This small PHPSpec extension allows you to test Magento 2.0 modules much more easier by utilizing generators of Magento\Framework\ObjectManager
.
Why?
Reasons why not to use ObjectManager
in PHPSpec examples:
- It is heavy and requires stubbing full file system in order to run a simple spec example.
- Depending on ObjectManager is a bad idea, as you don't want to test some-else DI overrides.
- Simple modules that do not require database do not need fully functional object manager
- Adapting your business logic to another framework will require from you only to materialize generated classes, instead of depending on the whole ObjectManager library.
Supported Generators
- Factory
- Repository
- Converter
- Persistor
- Mapper
- SearchResults
Installation
-
Install via composer
- Add to your phpspec.yml
Usage
Make sure that when you write examples to specify fully qualified class name for auto-generated class.
This approach will not get you a desired result, as PHP by default looks for undefined classes within the same namespace.
So instead of Magento\Catalog\Model\ProductFactory
it will generate a class spec\Acme\CustomMagentoModule\Model\ProductFactory
, that is definitely not a desired behavior.
In order to fix that make sure to specify fully qualified name in method signature or via use
operator in the file header.
Contribution
Make a pull request based on develop branch
All versions of phpspec-magento-di-adapter with dependencies
magento/framework Version ~100.0
zendframework/zend-stdlib Version ~2.4.6
zendframework/zend-code Version ~2.4.6
mikey179/vfsstream Version ^1.6