Git Product home page Git Product logo

behat-magento2-init's Introduction

Behat-Magento2InitExtension

Scrutinizer Code Quality Build Status

Behat-Magento2InitExtension provides access to the magento2 object manager through the BaseFixture class and allows you to change magento config settings temporarly when Behat is running.

Installation

Install by adding to your composer.json:

composer require --dev bex/behat-magento2-init

Configuration

Enable the extension in behat.yml like this:

default:
  extensions:
    Bex\Behat\Magento2InitExtension: ~

You can configure the magento bootstrap file location like this:

default:
  extensions:
    Bex\Behat\Magento2InitExtension:
      magento_bootstrap_path: /path/to/app/bootstrap.php

You can change magento config settings like this:

default:
  extensions:
    Bex\Behat\Magento2InitExtension:
      magento_configs:
        -
          path: 'admin/security/use_form_key'
          value: 0
        -
          path: 'your_module/special_config/awesome_field'
          value: 'somevalue'
          scope_type: 'stores' # allowed values: default, stores, websites; default value: default
          scope_code: 'your_store_code' # the website or store code; default value: null

Usage

When you run behat the extension will

  • configure the magento2 object manager automatically, so it will be available in all your fixture class which extends the Bex\Behat\Magento2InitExtension\Fixtures\BaseFixture class (see Bex\Behat\Magento2InitExtension\Fixtures\MagentoConfigManager as example).
  • change the config values before suit and revert the original config values after suit

behat-magento2-init's People

Contributors

adragus-inviqa avatar

Stargazers

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

Watchers

 avatar

behat-magento2-init's Issues

Optional M2 config keys are mandatory

Readme says:

      magento_configs:
        -
          path: 'admin/security/use_form_key'
          value: 0

But \Bex\Behat\Magento2InitExtension\Fixtures\MagentoConfigManager::isValidConfig() will fail every config which doesn't have all the keys defined - including scope_type and scope_code. I see no defaults set to them when they don't exist.

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.