public function update() { if (file_exists($this->_dumpFile)) { $this->sql = file_get_contents($this->_dumpFile); parent::update(); } }
public function testSql() { $update = new Kwf_Update_Sql(123, 'abc'); $tableName = uniqid("updatesql"); $update->sql = "CREATE TABLE {$tableName} (\n `id` INT NOT NULL ,\n PRIMARY KEY ( `id` ) \n ) ENGINE = INNODB"; $update->preUpdate(); $update->update(); $update->postUpdate(); $tables = array(); foreach (Kwf_Registry::get('db')->query("SHOW TABLES")->fetchAll() as $t) { reset($t); $tables[] = current($t); } $this->assertContains($tableName, $tables); Kwf_Registry::get('db')->query("DROP TABLE {$tableName}"); }