2017 © Pedro Peláez
 

library behat-magento-extension

Behat's extension that restore Magento at required state.

image

irs/behat-magento-extension

Behat's extension that restore Magento at required state.

  • Thursday, April 11, 2013
  • by irs
  • Repository
  • 2 Watchers
  • 0 Stars
  • 51 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Behat's extension for testing Magento based projects

Build Status, (*1)

This extension defines Behat hooks that can be used into feature's context that allows restore Magento in certain state., (*2)

Installation

To install this extension with Composer add folowing lines into your composer.json:, (*3)

{
    "require": {
        "irs/behat-magento-extension": "dev-master"
    }
}

and run composer install. After that to enable extension add following lines to behat.yml:, (*4)

default:
  extensions:
    Irs\BehatMagentoExtension\Extension:
      magento: /path/to/magento
      target: /path/to/target
      store: store_code        # default: empty
      scope: scope_code        # default: store
      database:
        host: test_db_host          # default: localhost
        user: test_db_user_name     # default: root
        password: test_db_password  # default: empty
        schema: test_db_schema    

Usage

To activate hooks you need to use Irs\BehatMagentoExtension\Context\MagentoHooks trait into you features' context., (*5)

On first run Magento will be installed into target (by Irs\MagentoInitializer\Installer\GenericInstaller) and after that deafult state will be saved into states/default.state. Magento will be restored from this state on before suite event., (*6)

To restore Magento to certain state before feature or before scenario you need to add tag @state:state_name to feature or scenario (correspondingly). For example, following code restores Magento to default state (that's saved into states/default.state) before "Successfully describing scenario":, (*7)

Feature: Your first feature
  In order to start using Behat
  As a manager or developer
  I need to try

  @state:default
  Scenario: Successfully describing scenario
    Given there is something
    When I do something
    Then I should see something

Current Magento state from target can be saved with bin\magento save-state command., (*8)

c:\>magento help save-state
Usage:
 save-state [-c|--config="..."] [-p|--config-profile="..."] [-s|--name="..."]

Options:
 --config (-c)         Path to Behat's config (default: "behat.yml")
 --config-profile (-p) Profile of Behat's config (default: "default")
 --name (-s)           State name (default: "states/2013-04-03-06-11-10.state")
 --help (-h)           Display this help message.
 --quiet (-q)          Do not output any message.
 --verbose (-v)        Increase verbosity of messages.
 --version (-V)        Display this application version.
 --ansi                Force ANSI output.
 --no-ansi             Disable ANSI output.
 --no-interaction (-n) Do not ask any interactive question.

The Versions

11/04 2013

dev-master

9999999-dev

Behat's extension that restore Magento at required state.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Vadim Kusakin

behat magento fixture