public static function setUpBeforeClass() { static::$fm = new FactoryMuffin(); static::$fm->setSaveMethod(function ($object) { // we just do not save anything :) return true; }); static::$fm->loadFactories(__DIR__ . '/../factories'); Faker::setLocale('en_EN'); }
<?php use League\FactoryMuffin\Faker\Facade as Faker; use einfach\representer\test\data\Author; /** @var $fm \League\FactoryMuffin\FactoryMuffin */ $fm->define(Author::class)->setDefinitions(['id' => Faker::randomDigit(), 'firstName' => Faker::firstName(), 'lastName' => Faker::lastName()]);
<?php use einfach\representer\test\data\Post; use einfach\representer\test\data\Author; use einfach\representer\test\data\Comment; use League\FactoryMuffin\Faker\Facade as Faker; /** @var $fm \League\FactoryMuffin\FactoryMuffin */ $fm->define(Post::class)->setDefinitions(['id' => Faker::randomDigit(), 'title' => Faker::sentence(), 'author_id' => "factory|" . Author::class, 'status' => Faker::randomElement([1, 2, 3]), 'pubDate' => Faker::dateTime()]);
public static function setupBeforeClass() { static::$fm = new FactoryMuffin(); static::$fm->loadFactories(__DIR__ . '/factories'); Faker::setLocale('en_GB'); }
<?php use League\FactoryMuffin\Faker\Facade as Faker; $fm->define('Fastwebmedia\\LaravelVouchering\\Models\\Campaign')->setDefinitions(['name' => Faker::name(), 'brand' => Faker::name(), 'urn' => Faker::ean8(), 'expiry_limit' => '14', 'is_active' => 1]); $fm->define('Fastwebmedia\\LaravelVouchering\\Models\\Voucher')->setDefinitions(['hash' => Faker::ean8(), 'campaign_id' => 1, 'is_redeemed' => '0', 'redeemed_at' => '0000-00-00:00-00-00', 'is_expired' => '0', 'expired_at' => '0000-00-00:00-00-00', 'is_valid' => '1']);