Coder Social home page Coder Social logo

weyandch / odmfixturestestcase Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 1blick/odmfixturestestcase

0.0 2.0 0.0 246 KB

A TestCase base class for Symfony2 (extending WebTestCase) that autoloads and purges ODM Fixtures from passed in bundle names.

License: MIT License

PHP 100.00%

odmfixturestestcase's Introduction

ODMFixturesTestCase for Symfony2

Build Status

A TestCase base class (extending WebTestCase) that autoloads and purges ODM Fixtures from passed in bundle names.

VERSION: Compatible for Symfony2 version >= 2.1.*

Installation

Composer

Add the following dependencies to your projects composer.json file:

"require": {
    # ..
    "einblick/odm-fixtures-test-case": "dev-master"
    # ..
}

Documentation

Simple usage example

<?php
namespace My\Namespace\Tests;

/**
 * Import the FixtureTestCase class
 */
use Einblick\ODMFixturesTestCase\Test\FixtureTestCase;

/**
 * This test will load ODM Fixtures from Bundles
 */
class MyODMFixtureLoadingTest extends FixtureTestCase
{
    /**
     * Pass the bundles you want to load the fixtures from
     *
     * @var array
     */
    public $fixtures = array(
        'MySuperBundle',
        'AnotherSuperBundle'
    );

    /**
     * Use it!
     */
    protected function setUp()
    {
        $options = array(

           // The document manager's service id
           'document_manager'  => 'doctrine.odm.mongodb.document_manager', // default

           // The directory structure inside the bundles where to look for Fixtures
           'default_directory' => '/DataFixtures/MongoDB' // default

       );

        $kernelOptions = array(
            // Same options as to WebTestCase::createKernel()
        );

        $this->loadFixtures($options, $kernelOptions);
    }

    /**
     * Don't forget to tearDown parent in overridden tearDown methods
     */
    protected function tearDown()
    {
        parent::tearDown();
    }
}

odmfixturestestcase's People

Contributors

weyandch avatar

Watchers

 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.