PHPackages                             irs/behat-magento-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. irs/behat-magento-extension

ActiveLibrary[Testing &amp; Quality](/categories/testing)

irs/behat-magento-extension
===========================

Behat's extension that restore Magento at required state.

0511PHP

Since Apr 11Pushed 13y ago2 watchersCompare

[ Source](https://github.com/irs/behat-magento-extension)[ Packagist](https://packagist.org/packages/irs/behat-magento-extension)[ RSS](/packages/irs-behat-magento-extension/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Behat's extension for testing Magento based projects
====================================================

[](#behats-extension-for-testing-magento-based-projects)

[![Build Status](https://camo.githubusercontent.com/ed8511804a53de4bd7b1f28cdecb7befec7b4c2118ec1544fc2531646ec1e2e8/68747470733a2f2f7472617669732d63692e6f72672f6972732f62656861742d6d6167656e746f2d657874656e73696f6e2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/irs/behat-magento-extension)

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

Installation
------------

[](#installation)

To install this extension with Composer add folowing lines into your `composer.json:`

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

and run `composer install.` After that to enable extension add following lines to `behat.yml:`

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

[](#usage)

To activate hooks you need to use `Irs\BehatMagentoExtension\Context\MagentoHooks` trait into you features' context.

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.

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":

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

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

```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a2ec8559d47c4108ceebbe9d794401e2d7685dadea0c0bbf15fa4f249ca5470a?d=identicon)[irs](/maintainers/irs)

---

Top Contributors

[![irs](https://avatars.githubusercontent.com/u/1466346?v=4)](https://github.com/irs "irs (7 commits)")

### Embed Badge

![Health badge](/badges/irs-behat-magento-extension/health.svg)

```
[![Health](https://phpackages.com/badges/irs-behat-magento-extension/health.svg)](https://phpackages.com/packages/irs-behat-magento-extension)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M341](/packages/dms-phpunit-arraysubset-asserts)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
