Coder Social home page Coder Social logo

spryker-fixtures's Introduction

Spryker Fixture Loader

Fixtures for Spryker

Fixtures

Orm\Zed\Customer\Persistence\SpyCustomer:
    customer_1:
        email: [email protected]
        customerReference: "customer_1"

Orm\Zed\Product\Persistence\SpyProductAbstract:
    product_1:
        sku: 1234-1234-1234
        attributes: "{}"

References can be specified with @:

Acme\Address:
    address_1:
        name: One
Acme\Person:
    person_1:
        address: @address_1

If a scalar value is required from a reference, a property can be specified after ::

Acme\Address:
    address_1:
        name: One
Acme\Person:
    person_1:
        address_id: @address_1:idAddress

Fixtures can be included relative to the current fixture file:

_include:
    - "common/lookuptables.yml"

FixtureOne:
    fixture_one:
        # ...

Included fixtures will be included before loading the rest of the file.

Installation

+++ b/src/Pyz/Zed/Console/ConsoleDependencyProvider.php
@@ -63,6 +63,7 @@ use Spryker\Zed\Transfer\Communication\Console\ValidatorConsole;
 use Spryker\Zed\Twig\Communication\Console\CacheWarmerConsole;
 use Spryker\Zed\ZedNavigation\Communication\Console\BuildNavigationConsole;
 use Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand;
+use DTL\Spryker\Fixtures\Console\FixtureConsole;

 /**
  * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -146,6 +147,7 @@ class ConsoleDependencyProvider extends SprykerConsoleDependencyProvider
         $commands = array_merge($commands, $propelCommands);

         if (Environment::isDevelopment() || Environment::isTesting()) {
+            $commands[] = new FixtureConsole();

Loading

$ ./vendor/bin/console inviqa:fixture:load path/to/fixtures.yml

ID resolution

The console returns a JSON list of fixture names => ids, use `--no-progress- to supress (most) other output:

$ ./vendor/bin/console inviqa:fixture:load tests/test.yml --no-progress
Store: DE | Environment: devtest
{"customer_1":56,"product_1":101}

This is useful when you have to load the fixtures from a remote process (e.g. an Yves context) and have no access to the database.

spryker-fixtures's People

Contributors

dantleech avatar

Watchers

 avatar James Cloos avatar Sam Burns avatar  avatar  avatar  avatar

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.