// Tear Down $fs->delete($dumpFile); dropDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $username); // Setup createDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); createDatabaseUserWithGrantsOnDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName, $username); $cmd = new nbMysqlDumpCommand(); $commandLine = sprintf('%s %s %s', $dbName, $dumpPath, $username); $t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'MysqlDump executed successfully'); $timestamp = date('YmdHi', time()); $dumpFile = sprintf('%s/%s/%s-%s.sql', getcwd(), $dumpPath, $dbName, $timestamp); $t->ok(file_exists($dumpFile), 'Dump file exists'); // Tear Down $fs->delete($dumpFile); dropDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $username); // Setup createDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); createDatabaseUserWithGrantsOnDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName, $username, $password); $parser = new nbCommandLineParser(); $parser->setDefaultConfigurationDirs(dirname(__FILE__) . '/../data/config'); $commandLine = '--config-file=mysql-plugin.yml'; $t->ok($cmd->run($parser, $commandLine), 'MysqlDump executed successfully from config file'); $timestamp = date('YmdHi', time()); $dumpFile = sprintf('%s/%s/%s-%s.sql', getcwd(), $dumpPath, $dbName, $timestamp); $t->ok(file_exists($dumpFile), 'Dump file exists'); // Tear down $fs->delete($dumpFile); dropDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $username);
} else { echo 'Failed' . PHP_EOL; $success = false; } foreach ($config['symlinks'] as $slink) { echo 'Removing ' . $slink . '... '; if (execute('rm -rf ' . $slink)) { echo 'OK' . PHP_EOL; } else { echo 'Failed' . PHP_EOL; $success = false; } } foreach ($dbs_to_drop as $db) { echo "Dropping '{$db}' database... "; if (dropDb($db, $config['DB_HOST'], $config['DB_USER'], $config['DB_PASS'], $config['DB_PORT'])) { echo 'OK' . PHP_EOL; } else { echo 'Failed' . PHP_EOL; $success = false; } } echo "Removing " . $config['BASE_DIR'] . "... "; if (execute("rm -rf " . $config['BASE_DIR'])) { echo 'OK' . PHP_EOL; } else { echo 'Failed' . PHP_EOL; $success = false; } if ($success) { echo 'Uninstall finished successfully' . PHP_EOL;