示例#1
0
$adminUsername = nbConfig::get('mysql_admin-username');
$adminPassword = nbConfig::get('mysql_admin-password');
$fileSystem->mkdir(nbConfig::get('archive_archive-dir_destination-dir'));
$t = new lime_test(2);
//Setup
try {
    $cmd = new nbMysqlDropCommand();
    $commandLine = sprintf('%s %s %s', $dbName, $adminUsername, $adminPassword);
    $cmd->run(new nbCommandLineParser(), $commandLine);
} catch (Exception $e) {
    $t->comment('Drop database: ' . $e->getMessage());
}
try {
    $cmd = new nbMysqlCreateCommand();
    $commandLine = sprintf('%s %s %s', $dbName, $adminUsername, $adminPassword);
    $cmd->run(new nbCommandLineParser(), $commandLine);
} catch (Exception $e) {
    $t->comment('Create database: ' . $e->getMessage());
}
$cmd = new nbSymfonyDeployCommand();
$parser = new nbCommandLineParser();
$parser->setDefaultConfigurationDirs(array(dirname(__FILE__) . '/../data/config'));
$t->comment('Symfony Deploy dry run');
$commandLine = '--config-file ';
$t->ok($cmd->run($parser, $commandLine), 'Symfony project deployed successfully');
$cmd = new nbSymfonyDeployCommand();
$parser = new nbCommandLineParser();
$parser->setDefaultConfigurationDirs(array(dirname(__FILE__) . '/../data/config'));
$t->comment('Symfony Deploy');
$commandLine = '--config-file --doit';
$t->ok($cmd->run($parser, $commandLine), 'Symfony project deployed successfully');
示例#2
0
$commandLine = sprintf('%s %s %s --username=%s', $dbName, $tempAdminUsername, $tempAdminPassword, $username);
$t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'Command MysqlCreate Command executed by admin user with password and user without password done');
// Tear down
dropDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName);
dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsername);
// Setup
createAdminUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsernameWithNoPassword);
$t->comment('MysqlCreateCommand executed by admin user without password');
$cmd = new nbMysqlCreateCommand();
$commandLine = sprintf('%s %s %s --username=%s --password=%s', $dbName, $tempAdminUsernameWithNoPassword, '', $username, $password);
$t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'Command MysqlCreate Command executed by admin user with password done');
// Tear down
dropDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName);
$t->comment('MysqlCreateCommand executed by admin user with password and user without password');
$cmd = new nbMysqlCreateCommand();
$commandLine = sprintf('%s %s %s --username=%s', $dbName, $tempAdminUsernameWithNoPassword, '', $username);
$t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'Command MysqlCreate Command executed by admin user with password and user without password done');
// Tear down
dropDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName);
dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsernameWithNoPassword);
// Setup
createAdminUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsername, $tempAdminPassword);
$cmd = new nbMysqlCreateCommand();
$parser = new nbCommandLineParser();
$parser->setDefaultConfigurationDirs(dirname(__FILE__) . '/../data/config');
$commandLine = '--config-file=mysql-plugin.yml';
$t->ok($cmd->run($parser, $commandLine), 'MysqlCreate executed successfully from config file');
// Tear down
dropDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName);
dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsername);
dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $username);