PHP code example of aaronbullard / factory-biscuit
1. Go to this page and download the library: Download aaronbullard/factory-biscuit 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/ */
aaronbullard / factory-biscuit example snippets
// Factories.php
use Faker\Generator;
use FactoryBiscuit\Factory;
use FactoryBiscuit\Tests\Mocks\Entity\Foo;
use FactoryBiscuit\Tests\Mocks\Entity\Bar;
$factory->define(Foo::class, function(Generator $faker, Factory $factory){
return [
'bar' => function() use ($factory){
return $factory->of(Bar::class)->make();
},
'baz' => $faker->word,
'qux' => $faker->word
];
});
$factory->define(Bar::class, function(Generator $faker, Factory $factory){
return [
'bar' => $faker->word
];
});
use FactoryBiscuit\Factory;
$factory = new Factory();
$factory->load(__DIR__ . '/Factories.php');