public static function setupBeforeClass() { Factory::loadFactories(__DIR__ . '/factories'); Factory::setCustomMaker(function ($class) { return $class::init('application'); }); }
/** * */ public static function setupBeforeClass() { FactoryMuffin::setCustomSaver(function () { return true; }); FactoryMuffin::setCustomSetter(function ($object, $name, $value) { $name = 'set' . ucfirst(strtolower($name)); if (method_exists($object, $name)) { $object->{$name}($value); } }); FactoryMuffin::loadFactories(dirname(dirname(dirname(__DIR__))) . '/Factories'); }
/** * @BeforeSuite */ public static function bootstrapSuite() { echo "- - - - - - Boot App, Database, and Muffin Factory. Yum! - - - - - - "; $unitTesting = true; $testEnvironment = 'testing'; $app = (require_once __DIR__ . '/../../bootstrap/start.php'); $app->boot(); $path = Config::get('database.connections.sqlite.database'); if (file_exists($path)) { unlink($path); } touch($path); Artisan::call('migrate:install'); FactoryMuffin::loadFactories(__DIR__ . '/../../tests/factories'); }
/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. */ public function setUp() { parent::setUp(); // if the database copy does not exist, call migrate. $copy = __DIR__ . '/../storage/database/testing-copy.db'; $original = __DIR__ . '/../storage/database/testing.db'; FactoryMuffin::loadFactories(__DIR__ . '/factories'); if (!file_exists($copy)) { touch($original); Artisan::call('migrate'); // create EUR currency /** @var TransactionCurrency $currency */ $currency = FactoryMuffin::create('FireflyIII\\Models\\TransactionCurrency'); $currency->code = 'EUR'; $currency->save(); copy($original, $copy); } else { if (file_exists($copy)) { copy($copy, $original); } } // if the database copy does exists, copy back as original. $this->session(['start' => Carbon::now()->startOfMonth(), 'end' => Carbon::now()->endOfMonth(), 'first' => Carbon::now()->startOfYear()]); }
public static function setupBeforeClass() { \League\FactoryMuffin\Facade::loadFactories(__DIR__ . '/factories'); }
/** * Load all the factories before the tests */ public static function setupBeforeClass() { FactoryMuff::setSaveMethod('save'); FactoryMuff::loadFactories(__DIR__ . '/../factories'); }
public static function setupBeforeClass() { FactoryMuffin::loadFactories(__DIR__ . '/factories'); $plugin = new DMAPlugin(new App()); $plugin->boot(); }