Releases: dwickstrom/Manager
Break out quote builder
To allow for building quotes alone, and have the order builder accept a quote that it simply converts to an order.
Code cleanup + test suite fixes
v1.04 Code cleanup
Add ability to add multiple instances of a dependency model
This release adds the functionality that allows you to for example att multiple products to an order. Rather than just 1 instance, which was the case before when it just to the last instance available in the fixtures array. Now it checks whether there are multiple instances available and if so does the builder allow for adding multiple instances, if both checks return true then it will add all instances available on the array of the same type.
This allows for:
$products = Factory::times(3)->make('catalog/product);
$order = Factory::with($products)->make('sales/quote);
... and so now the order will contain all three of those created products.
Bug fixes & Refactorings
Previous release was broken. Really. So I had to fix a bunch of stuff. This time it's less buggy.
Fixed:
- the multiplier functionality works as excpeted
- added a Manager::with() method to explicitly set dependencies
$customer = Mage::getModel('customer/customer')->load($id)
$arrayOfAddresses = Factory::with($customer)->times(3)->make('customer/address', [
'company' => 'Apple Inc'
]);
Refactored the code a bit so now some of the methods are less complex.
Extended capabilities through Factory class + refactorings
I have done some quite refactorings like adding a Factory class, and placed all generated fixtures in a static array to be able to more freely handle the creation and deletion of models within the scope of a single request.
Here is what the Factory syntax looks like:
$model = Factory::times(3)->make('catalog/product');
You can also explicitly set a model that you want to be used as a dependency:
$customer = Mage::getModel('customer/customer')->load($customerId);
Factory::setFixture($customer);
Factory::make('customer/address');
Now your loaded customer will get the new address added to its address book.
Identifiers of all created models are stored in a text file, so that they can be deleted on the next request.
Fixture provider can also handle php type fixture files, which also has fzaninotto/Faker available for use.