/** * @since 2.5 * * @param string $tableName */ public function drop($tableName) { $sql = "DROP TEMPORARY TABLE " . $tableName; if ($this->withAutoCommit) { $this->connection->queryWithAutoCommit($sql, __METHOD__); } else { $this->connection->query($sql, __METHOD__); } }
public function testDoQueryWithAutoCommit() { $database = $this->getMockBuilder('\\DatabaseBase')->disableOriginalConstructor()->setMethods(array('getFlag', 'clearFlag', 'setFlag', 'getType', 'query'))->getMockForAbstractClass(); $database->expects($this->any())->method('getType')->will($this->returnValue('mysql')); $database->expects($this->any())->method('getFlag')->will($this->returnValue(true)); $database->expects($this->once())->method('clearFlag'); $database->expects($this->once())->method('setFlag'); $readConnectionProvider = $this->getMockBuilder('\\SMW\\DBConnectionProvider')->disableOriginalConstructor()->getMock(); $readConnectionProvider->expects($this->atLeastOnce())->method('getConnection')->will($this->returnValue($database)); $writeConnectionProvider = $this->getMockBuilder('\\SMW\\DBConnectionProvider')->disableOriginalConstructor()->getMock(); $writeConnectionProvider->expects($this->atLeastOnce())->method('getConnection')->will($this->returnValue($database)); $instance = new Database($readConnectionProvider, $writeConnectionProvider); $instance->queryWithAutoCommit('foo'); }