PHP code example of funddy / fixture

1. Go to this page and download the library: Download funddy/fixture 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/ */

    

funddy / fixture example snippets




unddy\Fixture\Fixture\Fixture;
use Funddy\Fixture\Fixture\FixtureLinker;
use Funddy\Fixture\Fixture\FixtureLoader;

class HelloFixture extends Fixture
{
    public function load()
    {
        echo 'Hello!';
        $this->setReference('var', 'var');
    }

    public function getOrder()
    {
        return 0;
    }
}

class FooFixture extends Fixture
{
    private $foo;

    public function __construct($foo)
    {
        $this->foo = $foo;
    }

    public function load()
    {
        echo $this->foo;
        echo $this->getReference('var');
    }

    public function getOrder()
    {
        return 1;
    }
}

$fixtureLoader = new FixtureLoader();
$fixtureLinker = new FixtureLinker();

$helloFixture = new HelloFixture();
$helloFixture->setFixtureLinker($fixtureLinker);
$fixtureLoader->addFixture($helloFixture);

$fooFixture = new FooFixture('foo');
$fooFixture->setFixtureLinker($fixtureLinker);
$fixtureLoader->addFixture($fooFixture);

$fixtureLoader->loadAll();//Hello!foovar