Git Product home page Git Product logo

doctrinedatafixturesextension's Introduction

Doctrine Fixtures Extension for Behat

The extension increases feature test isolation by reloading ORM data fixtures between scenarios and features.

Installation

composer require "behat-extension/doctrine-data-fixtures-extension"

Configuration

Activate extension in your behat.yml and define any fixtures to be loaded:

# behat.yml
default:
  # ...
  extensions:
    BehatExtension\DoctrineDataFixturesExtension\Extension:
      lifetime:    'feature'
      autoload:    true
      directories: ~
      fixtures:    ~

When lifetime is set to "feature" (or unspecified), data fixtures are reloaded between feature files. Alternately, when lifetime is set to "scenario", data fixtures are reloaded between scenarios (i.e., increased test isolation at the expense of increased run time).

When autoload is true, the extension will load the data fixtures for registered bundles. Please note that only fixtures stored in the folder /DataFixtures/ORM of the bundles are loaded. If you want to load fixtures tagged with doctrine.fixture.orm, you must enable the bundle BehatExtension\DoctrineDataFixturesExtension\Bundle\BehatDoctrineDataFixturesExtensionBundle in your test AppKernel class.

When fixtures is set, the DoctrineDataFixtures extension will load the specified fixture classes.

When directories is set, the DoctrineDataFixtures extension will load the data fixtures globed from the respective directories.

# behat.yml
default:
  # ...
  extensions:
    BehatExtension\DoctrineDataFixturesExtension\Extension:
      lifetime: 'feature'
      autoload: true
      directories:
        - '/project/src/AcmeAnalytics/Tests/DataFixtures/ORM'
      fixtures:
        - 'Acme\StoreBundle\DataFixture\ORM\Categories'
        - 'Acme\StoreBundle\DataFixture\ORM\Apps'
        - 'Acme\VendorBundle\DataFixture\ORM\Vendors'

Backup System

To speed up the tests, a backup system is available. The whole database will be set in cache and reloaded when needed. You should periodically clear the cache as it does not detect changes to the data fixture contents because the hash is based on the collection of data fixture class names.

This feature is only available for the following SGDB: SQLite, MySQL, PostgreSQL.

It is enabled by default. To disable it, you just have to set use_backup: false in the extension configuration:

# behat.yml
default:
  # ...
  extensions:
    BehatExtension\DoctrineDataFixturesExtension\Extension:
      lifetime: 'feature'
      autoload: true
      use_backup: false

Source

Github: https://github.com/BehatExtension/DoctrineDataFixturesExtension

Forked from https://github.com/vipsoft/DoctrineDataFixturesExtension

Copyright

  • Copyright (c) 2012 Anthon Pang.
  • Copyright (c) 2016-2018 Florent Morselli.

See LICENSE for details.

Contributors

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.