/** * Because DBUnit does not really provide tools for working with schema, we * manually clean up our DB before and after each test. We run before in * case the previous test run failed and we have stuff laying around still. * We run after because who likes seeing artifacts of old test runs hanging * around their DB? */ private function cleanDb() { $db = $this->runner->connectDb(); if ($db->getConnection() instanceof \wpdb) { // Forcing reconnect because of quirky wpdb during testing with lots of queries // @see http://core.trac.wordpress.org/ticket/23085 $db->getConnection()->db_connect(); } $db->query('DROP TABLE IF EXISTS dewdrop_test_dbdeploy_changelog'); $db->query('DROP TABLE IF EXISTS dewdrop_test_plugins'); $db->query('DROP TABLE IF EXISTS dewdrop_test_dewdrop_tests'); }
public function testConnectDb() { $runner = new \Dewdrop\Cli\Run(); $this->assertTrue($runner->connectDb() instanceof \Dewdrop\Db\Adapter); }