funddy / fixture
Fixture component
Installs: 1 214
Dependents: 1
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.3
Requires (Dev)
- mockery/mockery: >=0.7.2
- phpunit/phpunit: >=3.7
This package is not auto-updated.
Last update: 2025-02-15 15:02:18 UTC
README
Very simple fixtures library.
Setup and Configuration
Add the following to your composer.json file:
{ "require": { "funddy/fixture": "2.0.*" } }
Update the vendor libraries:
curl -s http://getcomposer.org/installer | php
php composer.phar install
Usage
<?php require 'vendor/autoload.php'; use Funddy\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