Giter Site home page Giter Site logo

manager's Introduction

Manager

Build Status Scrutinizer Code Quality

Manager is a PHP library that manages test fixtures for a Magento site.

Fixtures

Manager takes YAML files as an input to create fixtures for a Magento test environment.

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.

Defining a model in a YAML file would look like this:

customer/customer:
    firstname: test
    lastname: test
    email: [email protected]
    password: 123123pass
    website_id: 1
    store: 1
    status: 1

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
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.

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).

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

manager's People

Contributors

debo avatar everzet avatar jamescowie avatar shanethehat avatar villekoykka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

manager's Issues

Custom attribute values

It would be good to be able to load the default values from yaml, but still pass some attribute values that override the ones from yml before saving - this allows easier integration with behat steps such as "I have a product with special price "8" pounds" or similar.

Auto sku generation

Would be good to be able to create a product without giving any required attributes manually - eg generating a unique sku could be managers responsibly.

This would work well together with the other feature request to be able to override specific attributes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.