PHP code example of einblick / odm-fixtures-test-case
1. Go to this page and download the library: Download einblick/odm-fixtures-test-case library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
einblick / odm-fixtures-test-case example snippets
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();
}
}