public function testReLoad() { Closure::bind(function () { Database::$instance = null; Database::load(__DIR__ . '/resources/database.sqlite.test'); $tmp = Database::$instance; Database::reload(__DIR__ . '/resources/database.sqlite.test'); $this->assertNotSame(Database::$instance, $tmp); }, $this, '\\Hikouki\\Stigma\\Database')->__invoke(); }
/** * Execute. * @param $databaseFilePath Database file path. * @param $target replace target string. * @param $replace replaced string. * @return void */ public function execute($databaseFilePath, $target, $replace) { Database::load($databaseFilePath); $tables = Model::findAllTableStructure(); foreach ($tables as $table) { $rows = Model::findAll($table); foreach ($rows as &$row) { if ($this->replaceIfHit($row, $target, $replace)) { Model::updateRow($row, $table); } } } }