public function setUp() { parent::setUp(); $this->migrationPath = realpath(__DIR__ . '/../../protected/migration'); if (is_dir($this->migrationPath)) { File::removeDirectory($this->migrationPath); } mkdir($this->migrationPath, 0777, true); $this->m = new Migration(new Test(), $this->migrationPath); }
public function setUp() { parent::setUp(); if (getenv('TRAVIS')) { $this->settings = (require __DIR__ . '/config_travis.php'); } else { if (is_file(__DIR__ . '/config_local.php')) { $this->settings = (require __DIR__ . '/config_local.php'); } else { $this->settings = ['default' => ['class' => '\\Mindy\\Query\\Connection', 'dsn' => 'sqlite::memory:']]; } } $this->manager = new ConnectionManager(['databases' => $this->settings]); ConnectionManager::$defaultDatabase = $this->driver; $this->initModels($this->getModels()); }
public function setUp() { parent::setUp(); $category = new Category(); $category->name = 'test'; $category->save(); $user = new User(); $user->password = 123456; $user->username = '******'; $user->save(); $customer = new Customer(); $customer->user = $user; $customer->address = 'example super address'; $customer->save(); $products = []; foreach ([1, 2, 3, 4, 5] as $i) { $product = new Product(); $product->name = $i; $product->price = $i; $product->description = $i; $product->category = $category; $product->save(); $products[] = $product; } $order1 = new Order(); $order1->customer = $customer; $order1->save(); foreach ($products as $p) { $order1->products->link($p); } $order2 = new Order(); $order2->customer = $customer; $order2->discount = 1; $order2->save(); $order2->products = $products; $order2->save(); }