/** * Migrate & Seed the test DB */ public function setUp() { parent::setUp(); if (!$this->use_database) { return; } if ($this->test_db) { Config::set('database.connections.' . DB::getName() . '.database', $this->test_db); DB::reconnect(); } $this->pdo = DB::connection()->getPdo(); $this->pdo->beginTransaction(); }
/** * Identify the database and get the ID. * Only MySQL. * @return int */ private static function getServerShardId() { try { $database_name = DB::getName(); } catch (\PDOException $e) { return $e; } switch ($database_name) { case 'mysql': return (int) self::getMySqlServerId(); default: return (int) 1; } }
/** * Create a new command instance. * * @return void */ public function __construct() { parent::__construct(); $this->default_db_type = DB::getName(); $this->default_db_name = DB::getDatabaseName(); }