Example #1
0
 /**
  * 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);
             }
         }
     }
 }
Example #2
0
 public function testFindAllTableStructure()
 {
     $tables = Model::findAllTableStructure();
     $this->assertSame($tables, ['robots', 'users']);
 }