<?php require_once dirname(__FILE__) . '/../bootstrap/unit.php'; $logDir = $symfonyRootDir . '/log'; $cacheDir = $symfonyRootDir . '/cache'; $dbName = 'nbSymfonyPlugintest_dev'; $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');
if (!checkMysql()) { return true; } $t = new lime_test(3); $t->comment('Mysql Drop Command'); // Setup createAdminUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsername, $tempAdminPassword); createDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); $t->comment('MysqlDropCommand executed by admin user with password'); $cmd = new nbMysqlDropCommand(); $commandLine = sprintf('%s %s %s', $dbName, $tempAdminUsername, $tempAdminPassword); $t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'MysqlDrop executed successfully'); //TearDown dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsername); // Setup createAdminUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsernameWithNoPassword); createDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); $t->comment('MysqlDropCommand executed by admin user without password'); $cmd = new nbMysqlDropCommand(); $commandLine = sprintf('%s %s', $dbName, $tempAdminUsernameWithNoPassword); $t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'MysqlDrop executed successfully'); //TearDown dropDatabaseUser($mysqlAdminUsername, $mysqlAdminPassword, $tempAdminUsernameWithNoPassword); // Setup createDb($mysqlAdminUsername, $mysqlAdminPassword, $dbName); $cmd = new nbMysqlDropCommand(); $parser = new nbCommandLineParser(); $parser->setDefaultConfigurationDirs(dirname(__FILE__) . '/../data/config'); $commandLine = '--config-file=mysql-plugin.yml'; $t->ok($cmd->run($parser, $commandLine), 'MysqlDrop executed successfully from config file');