/** * Test drop database. */ public function testDropDatabase() { $this->connection->execute('CREATE DATABASE activecollab_database_connection_test_create'); $this->assertTrue($this->connection->databaseExists('activecollab_database_connection_test_create')); $this->connection->dropDatabase('activecollab_database_connection_test_create'); $this->assertFalse($this->connection->databaseExists('activecollab_database_connection_test_create')); }
/** * Test list tables from a specified database (user needs to have proper permissions over that database). */ public function testListTablesFromAnotherDatabase() { if ($this->connection->databaseExists('test_another_database')) { $this->connection->execute('DROP DATABASE `test_another_database`'); } $this->connection->execute('CREATE DATABASE `test_another_database`'); $this->assertTrue($this->connection->databaseExists('test_another_database')); $this->connection->execute('CREATE TABLE `test_another_database`.`test_table` (id INT(11) UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT)'); $this->assertEquals(['test_table'], $this->connection->getTableNames('test_another_database')); $this->connection->execute('DROP DATABASE `test_another_database`'); $this->assertFalse($this->connection->databaseExists('test_another_database')); }
/** * Test user exists call. */ public function testUserExists() { $this->assertTrue($this->connection->userExists('root')); $this->assertFalse($this->connection->databaseExists('this one does not exist')); }