2017 © Pedro Peláez
 

library manager

Magento fixture manager

image

magetest/manager

Magento fixture manager

  • Tuesday, November 11, 2014
  • by joshporter
  • Repository
  • 15 Watchers
  • 18 Stars
  • 25,273 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 11 Forks
  • 7 Open issues
  • 4 Versions
  • 5 % Grown

The README.md

Manager

Build Status Scrutinizer Code Quality, (*1)

Manager is a PHP library that manages test fixtures for a Magento site., (*2)

Fixtures

Manager takes YAML files as an input to create fixtures for a Magento test environment., (*3)

A YAML file maps to a Magento model via the key of the collection. The collection then maps to the model attributes of the defined Magento model., (*4)

Defining a model in a YAML file would look like this: ``` yaml customer/customer: firstname: test lastname: test email: customer@example.com password: 123123pass website_id: 1 store: 1 status: 1, (*5)

The most important part, is the key in the collection. This is the argument supplied to `Mage::getModel()`.
After we define the fixture, all we need to do now is load it into the Manager.

``` php
<?php
use MageTest\Manager\FixtureManager,
    MageTest\Manager\Attributes\Provider\YamlProvider;

//init Manager and define attributes provider. Default is YAML
$manager = new FixtureManager(new YamlProvider());

//Load fixture by model type into manager
$manager->loadFixture('customer/customer');

//Use key defined in fixture file, to return instance of fixture model
$customer = $manager->getFixture('customer/customer');

//Use customer model, change values/behaviour, assert data for acceptance tests

//Delete all fixtures from Magento test environment DB
$manager->clear();

Usage

This library can be used in conjunction with Behat (or any other acceptance/functional testing tool of choice). The flow could look something like this: - Instantiate Manager before the scenario - Before a feature, load required model(s) for acceptance test - After the scenario, call clear() to clean up fixtures., (*6)

The aim is to keep the Step Defintions slim, and abstract away the DB interactions required to set up test data (think what Mink does as a web browser emulator abstraction)., (*7)

Roadmap

  • Default model builder.
  • Add support for Configurable products, Bundled products
  • Handle multiple instances of the same fixture.
  • JSON, XML attribute providers.

Contributors

Authors: https://github.com/MageTest/Manager/contributors, (*8)

The Versions

11/11 2014

dev-feature/override-yaml-file

dev-feature/override-yaml-file

Magento fixture manager

  Sources   Download

MIT

The Requires

 

The Development Requires

testing magento fixture

14/10 2014

dev-master

9999999-dev

Magento fixture manager

  Sources   Download

MIT

The Requires

 

The Development Requires

testing magento fixture

15/08 2014

dev-feature/config-product-builder

dev-feature/config-product-builder

Magento fixture manager

  Sources   Download

MIT

The Requires

 

The Development Requires

testing magento fixture

04/08 2014

v0.9.0

0.9.0.0

Magento fixture manager

  Sources   Download

MIT

The Requires

 

The Development Requires

testing magento fixture