$fs->delete($otherFileToSync); $t->ok($cmd->run(new nbCommandLineParser(), '--doit --exclude-from=' . $excludeFile . ' ' . $commandLine), 'Command nbDirTransfer called successfully exclude file'); $t->ok(!file_exists($folderToExclude), 'folderToExclude was not synchronized in the target site'); $t->ok(!file_exists($fileToExclude), 'fileToExclude was not synchronized in the target site'); $t->ok(!file_exists($fileToInclude), 'fileToInclude was not synchronized in the target site'); $t->ok(file_exists($fileToSync), 'fileToSync was synchronized in the target folder'); $t->ok(file_exists($otherFileToSync), 'otherFileToSync was synchronized in the target folder'); $fs->delete($fileToSync); $fs->delete($otherFileToSync); $t->ok($cmd->run(new nbCommandLineParser(), '--doit --exclude-from=' . $excludeFile . ' --include-from=' . $includeFile . ' ' . $commandLine), 'Command nbDirTransfer called successfully'); $t->ok(!file_exists($folderToExclude), 'folderToExclude was not synchronized in the target site'); $t->ok(!file_exists($fileToExclude), 'fileToExclude was not synchronized in the target site'); $t->ok(file_exists($fileToInclude), 'fileToInclude was synchronized in the target site'); $t->ok(file_exists($fileToSync), 'fileToSync was synchronized in the target folder'); $t->ok(file_exists($otherFileToSync), 'otherFileToSync was synchronized in the target folder'); $fs->delete($fileToSync); $fs->delete($fileToInclude); $fs->delete($otherFileToSync); $commandLine = '--delete --config-file=config.yml'; $parser = new nbCommandLineParser(); $parser->setDefaultConfigurationDirs($dataDir); $t->ok($cmd->run($parser, '--doit --exclude-from=' . $excludeFile . ' --include-from=' . $includeFile . ' ' . $commandLine), 'Command nbDirTransfer called successfully'); $t->ok(!file_exists($folderToExclude), 'folderToExclude was not synchronized in the target site'); $t->ok(!file_exists($fileToExclude), 'fileToExclude was not synchronized in the target site'); $t->ok(file_exists($fileToInclude), 'fileToInclude was synchronized in the target site'); $t->ok(file_exists($fileToSync), 'fileToSync was synchronized in the target folder'); $t->ok(file_exists($otherFileToSync), 'otherFileToSync was synchronized in the target folder'); $fs->delete($fileToSync); $fs->delete($fileToInclude); $fs->delete($otherFileToSync); $fs->touch($targetDir . '/readme');
$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'); $fileSystem->rmdir($logDir, true, true); $fileSystem->rmdir($cacheDir, true, true); $fileSystem->rmdir(nbConfig::get('archive_archive-dir_destination-dir'), true);
protected function executeCommand(nbCommand $command, $commandLine, $doit, $verbose) { if ($doit) { $parser = new nbCommandLineParser(); $parser->setDefaultConfigurationDirs($this->getParser()->getDefaultConfigurationDirs()); $command->run($parser, $commandLine); } if ($verbose) { $this->logLine(sprintf("%s %s\n", $command->getFullName(), $commandLine), nbLogger::COMMENT); } }