/** * Method to test dropTable(). * * @return void * * @covers Windwalker\Query\Mysql\MysqlQueryBuilder::dropTable */ public function testDropTable() { $expected = "DROP TABLE {$this->qn('foo')}"; $actual = MysqlQueryBuilder::dropTable('foo'); $this->assertEquals($this->format($expected), $this->format($actual)); $expected = "DROP TABLE IF EXISTS {$this->qn('foo')}"; $actual = MysqlQueryBuilder::dropTable('foo', true); $this->assertEquals($this->format($expected), $this->format($actual)); }
/** * tearDownAfterClass * * @return void */ public static function tearDownAfterClass() { if (static::$dbo) { try { static::$dbo->setQuery(MysqlQueryBuilder::dropTable('#__cloud', true))->execute(); } catch (\Exception $e) { // Do nothing } try { static::$dbo->setQuery(MysqlQueryBuilder::dropTable('#__wind', true))->execute(); } catch (\Exception $e) { // Do nothing } } parent::tearDownAfterClass(); }
/** * drop * * @param bool $ifExists * @param string $option * * @return static */ public function drop($ifExists = true, $option = '') { $query = MysqlQueryBuilder::dropTable($this->table, $ifExists, $option); $this->db->setQuery($query)->execute(); return $this; }
/** * Method to test dropTable(). * * @return void * * @covers Windwalker\Query\Mysql\MysqlQueryBuilder::dropTable */ public function testDropTable() { $expected = "DROP TABLE {$this->qn}foo{$this->qn}"; $actual = MysqlQueryBuilder::dropTable('foo'); $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual)); $expected = "DROP TABLE IF EXISTS {$this->qn}foo{$this->qn}"; $actual = MysqlQueryBuilder::dropTable('foo', true); $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual)); }