예제 #1
0
 /**
  * Register a new plugin for autoloading.
  * 
  */
 private function addPlugin($pluginName)
 {
     //    nbLogger::getInstance()->logLine('Loading Plugin <comment>' . $pluginName . '</comment>...');
     if (key_exists($pluginName, $this->plugins)) {
         return true;
     }
     foreach ($this->pluginDirs as $dir) {
         $path = $dir . '/' . $pluginName;
         if (is_dir($path)) {
             $this->plugins[$pluginName] = $path;
         }
     }
     if (!key_exists($pluginName, $this->plugins)) {
         throw new Exception(sprintf('Plugin %s not found', $pluginName));
     }
     nbAutoload::getInstance()->addDirectory($this->plugins[$pluginName] . '/lib', '*.php', true);
     nbAutoload::getInstance()->addDirectory($this->plugins[$pluginName] . '/command', '*Command.php', true);
     nbAutoload::getInstance()->addDirectory($this->plugins[$pluginName] . '/vendor');
     self::$commandLoader->addCommandsFromDir($this->plugins[$pluginName] . '/command');
     if (is_dir($this->plugins[$pluginName] . '/test/unit')) {
         $testDirs = nbConfig::get('nb_plugin_test_dirs', array());
         $testDirs[] = $this->plugins[$pluginName] . '/test/unit';
         nbConfig::set('nb_plugin_test_dirs', array_unique($testDirs));
     }
     if (!file_exists($this->plugins[$pluginName] . '/config/config.yml')) {
         return true;
     }
     $yamlParser = new nbYamlConfigParser();
     $yamlParser->parseFile($this->plugins[$pluginName] . '/config/config.yml', '', true);
 }
예제 #2
0
파일: nbApplication.php 프로젝트: nubee/bee
 protected function handleOptions(array $options)
 {
     $logger = nbLogger::getInstance();
     if (isset($options['verbose'])) {
         $this->verbose = true;
     }
     if (isset($options['trace'])) {
         $this->verbose = true;
         $this->trace = true;
     }
     if (isset($options['version'])) {
         $logger->log(($this->verbose ? $this->getName() . ' version ' : '') . $this->getVersion());
         return true;
     }
     if (isset($options['help'])) {
         $logger->log($this->formatHelp($this->arguments, $this->options));
         return true;
     }
     if (isset($options['config'])) {
         foreach ($options['config'] as $option) {
             $property = preg_split('/[\\s]*=[\\s]*/', $option, 2);
             nbConfig::set($property[0], $property[1]);
         }
     }
     if (isset($options['enable-plugin'])) {
         $this->serviceContainer->pluginLoader->loadPlugins($options['enable-plugin']);
     }
     if (isset($options['enable-all-plugins'])) {
         $this->serviceContainer->pluginLoader->loadAllPlugins();
     }
     return false;
 }
예제 #3
0
<?php

require_once dirname(__FILE__) . '/../../../../test/bootstrap/unit.php';
nbConfig::set('nb_command_dir', nbConfig::get('nb_sandbox_dir'));
$projectDir = nbConfig::get('nb_sandbox_dir');
$configDir = nbConfig::get('nb_sandbox_dir') . '/.bee';
$beeConfig = $configDir . '/bee.yml';
$config = $configDir . '/config.yml';
$fileSystemConfig = $configDir . '/filesystem-plugin.yml';
$multiChangeModeConfig = $configDir . '/filesystem-multi-change-mode.yml';
$dirTransferConfig = $configDir . '/filesystem-dir-transfer.yml';
function isPluginEnabled($beeConfig, $plugin)
{
    if (!file_exists($beeConfig)) {
        throw new Exception('bee config file not found');
    }
    $parser = sfYaml::load($beeConfig);
    $plugins = isset($parser['project']['bee']['enabled_plugins']) ? $parser['project']['bee']['enabled_plugins'] : array();
    return in_array($plugin, $plugins);
}
$t = new lime_test(12);
$cmd = new nbGenerateProjectCommand();
$t->ok($cmd->run(new nbCommandLineParser(), $projectDir), 'Command nbGenerateProjectCommand called successfully');
$t->ok(file_exists($beeConfig), 'bee.yml added to the destination dir :' . $beeConfig);
$t->ok(file_exists($config), 'config.yml added to the destination dir :' . $config);
$t->comment('enabling nbDummyPlugin');
$plugin = 'nbDummyPlugin';
$t->ok(!isPluginEnabled($beeConfig, $plugin), $plugin . ' not found');
$cmd = new nbEnablePluginCommand();
$t->ok($cmd->run(new nbCommandLineParser(), $plugin . ' ' . $projectDir), 'Plugin enabled successfully');
$t->ok(isPluginEnabled($beeConfig, $plugin), $plugin . ' found');
예제 #4
0
<?php

require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
class testShellCommand extends nbShellExecuteCommand
{
    public function getAlias($command)
    {
        return parent::getAlias($command);
    }
}
$shellCommand = new testShellCommand();
$t = new lime_test();
$t->is($shellCommand->getAlias('command'), null, '->getAlias() returns null if param isn\'t an alias');
nbConfig::set('project_shell_aliases_command', 'realCommand');
nbConfig::set('project_shell_aliases_anotheralias', 'another real command');
$t->is($shellCommand->getAlias('command'), 'realCommand', '->getAlias() returns real command if param is an alias');
$t->is($shellCommand->getAlias('anotheralias'), 'another real command', '->getAlias() returns real command if param is an alias');
$t->comment('nbShellExecuteCommandTest - pass args value to command line');
ob_start();
$t->ok(!$shellCommand->run(new nbCommandLineParser(array(), array()), 'dir --args="-Doption=true"'));
$contents = ob_get_contents();
ob_end_clean();
ob_start();
$t->ok($shellCommand->run(new nbCommandLineParser(array(), array()), 'dir'));
$contents = ob_get_contents();
ob_end_clean();
예제 #5
0
<?php

require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
nbConfig::set('nb_command_dir', nbConfig::get('nb_sandbox_dir') . '/command');
nbConfig::set('nb_plugins_dir', nbConfig::get('nb_sandbox_dir') . '/plugins');
$commandDir = nbConfig::get('nb_command_dir');
$pluginsDir = nbConfig::get('nb_plugins_dir');
$t = new lime_test(7);
//Setup
nbFileSystem::getInstance()->mkdir($commandDir);
nbFileSystem::getInstance()->mkdir($pluginsDir . '/myPlugin/command', true);
nbFileSystem::getInstance()->mkdir($commandDir . '/customFolder');
$cmd = new nbGenerateCommandCommand();
$cmd->run(new nbCommandLineParser(), 'ns:cmd className');
$t->ok(file_exists($commandDir . '/ns/className.php'), 'Command create new CommandFile in command folder');
$cmd->run(new nbCommandLineParser(), '--force ns:cmd className');
$t->ok(file_exists($commandDir . '/ns/className.php'), 'Command can overwrite a file');
$cmd->run(new nbCommandLineParser(), 'ns2:cmd className');
$t->ok(file_exists($commandDir . '/ns2/className.php'), 'Command create new CommandFile in command folder');
$cmd->run(new nbCommandLineParser(), 'cmd className');
$t->ok(file_exists($commandDir . '/className.php'), 'Command can create default (non namespace) commands');
$cmd->run(new nbCommandLineParser(), '-f :cmd className');
$t->ok(file_exists($commandDir . '/className.php'), 'Command can create default (non namespace) commands');
$cmd->run(new nbCommandLineParser(), '--directory=' . $commandDir . '/customFolder :cmd className');
$t->ok(file_exists($commandDir . '/customFolder/className.php'), 'Command accept --directory option');
// plugin command
$cmd->run(new nbCommandLineParser(), '--plugin=myPlugin myPluginNs:cmd className');
$t->ok(file_exists($pluginsDir . '/myPlugin/command/myPluginNs/className.php'), 'Command accept --plugin option');
// Tear down
nbFileSystem::getInstance()->rmdir($commandDir, true);
nbFileSystem::getInstance()->rmdir($pluginsDir, true);
예제 #6
0
    $t->pass('nbApplication::verifyOption() throws if there are some options in beeApplication and in new command');
}
try {
    $application->run('bar');
    $t->pass('nbApplication::verifyOption() doesn\'t throw if there are different options in beeApplication and in new command');
} catch (Exception $e) {
    $t->fail('nbApplication::verifyOption() doesn\'t throw if there are different options in beeApplication and in new command');
}
try {
    $application->run();
    $t->pass('nbApplication::verifyOption() doesn\'t throw if there are different options in beeApplication and in new command');
} catch (Exception $e) {
    $t->fail('nbApplication::verifyOption() doesn\'t throw if there are different options in beeApplication and in new command');
}
$t->comment('nbApplicationTest - Test --config option');
nbConfig::set('nb_pathtest', 'valuetest');
$application = new DummyBeeApplication($serviceContainer);
$foo = new DummyCommand('foo', null, new nbOptionSet(array(new nbOption('first', 'f'))));
$serviceContainer->commandLoader->reset();
$serviceContainer->commandLoader->addCommands(array($foo));
$application->run('--config=nb_pathtest=cmdvaluetest foo');
$t->is(nbConfig::get('nb_pathtest'), 'cmdvaluetest', 'option "--config" overrides nbConfig property');
$t->ok($foo->hasExecuted(), 'command "foo" has executed');
$application = new DummyBeeApplication($serviceContainer);
$foo = new DummyCommand('foo', null, new nbOptionSet(array(new nbOption('first', 'f'))));
$serviceContainer->commandLoader->reset();
$serviceContainer->commandLoader->addCommands(array($foo));
$application->run('--config="nb_pathtest = cmdvaluetest" foo');
$t->is(nbConfig::get('nb_pathtest'), 'cmdvaluetest', 'option "--config" overrides nbConfig property');
$t->ok($foo->hasExecuted(), 'command "foo" has executed');
$application = new DummyBeeApplication($serviceContainer);
예제 #7
0
<?php

require_once dirname(__FILE__) . '/../../../../test/bootstrap/unit.php';
nbConfig::set('nb_command_dir', nbConfig::get('nb_sandbox_dir'));
nbConfig::set('nb_plugins_dir', nbConfig::get('nb_test_plugins_dir'));
$configDir = nbConfig::get('nb_sandbox_dir') . '/.bee';
$beeYaml = $configDir . '/bee.yml';
$configYaml = $configDir . '/config.yml';
$projectType = 'foo';
$t = new lime_test(32);
$cmd = new nbGenerateProjectCommand();
$t->ok($cmd->run(new nbCommandLineParser(), nbConfig::get('nb_sandbox_dir')), 'Command nbGenerateProjectCommand called successfully');
$t->ok(file_exists($beeYaml), 'bee.yml added to the destination dir :' . $beeYaml);
$t->ok(file_exists($configYaml), 'config.yml added to the destination dir :' . $configYaml);
try {
    $cmd->run(new nbCommandLineParser(), nbConfig::get('nb_sandbox_dir'));
    $t->fail('Exception not thrown');
} catch (Exception $e) {
    $t->pass('Exception nbFileSystem::copy() thrown');
}
$t->ok($cmd->run(new nbCommandLineParser(), '--force ' . nbConfig::get('nb_sandbox_dir')), 'Command nbGenerateProjectCommand called successfully');
$t->ok(file_exists($beeYaml), 'bee.yml added to the destination dir :' . $beeYaml);
$t->ok(file_exists($configYaml), 'config.yml added to the destination dir :' . $configYaml);
// Tear down
$fs = nbFileSystem::getInstance();
$fs->delete($beeYaml);
$fs->delete($configYaml);
$fs->rmdir($configDir);
$t->ok($cmd->run(new nbCommandLineParser(), sprintf('--type=%s %s', $projectType, nbConfig::get('nb_sandbox_dir')), 'Command nbGenerateProjectCommand called successfully'));
$t->ok(file_exists($beeYaml), 'bee.yml added to the destination dir :' . $beeYaml);
$t->ok(file_exists($configYaml), 'config.yml added to the destination dir :' . $configYaml);
예제 #8
0
<?php

require_once dirname(__FILE__) . '/../../../../test/bootstrap/unit.php';
nbConfig::set('nb_plugins_dir', nbConfig::get('nb_data_dir') . '/plugins');
nbConfig::set('nb_config_dir', nbConfig::get('nb_sandbox_dir') . '/config');
$configDir = nbConfig::get('nb_config_dir');
$dataDir = nbConfig::get('nb_data_dir') . '/config';
$pluginName = 'FirstPlugin';
$compareFile1 = $dataDir . '/plugin.compare.yml';
$compareFile2 = $dataDir . '/command.compare.yml';
$destinationFile1 = $configDir . '/plugin.yml';
$destinationFile2 = $configDir . '/command.yml';
$pluginFile = 'plugin.template.yml';
$commandFile = 'command.template.yml';
$fs = nbFileSystem::getInstance();
// Support functions
function removeCarriageReturn($text)
{
    return str_replace("\r", '', $text);
}
$t = new lime_test(3);
$t->comment('Configure Plugin');
$cmd = new nbConfigurePluginCommand();
$t->ok($cmd->run(new nbCommandLineParser(), $pluginName), 'Plugin configured');
$content1 = removeCarriageReturn(file_get_contents($destinationFile1));
$compare1 = removeCarriageReturn(file_get_contents($compareFile1));
$t->is($content1, $compare1, 'Generated plugin config file content is correct');
$content2 = removeCarriageReturn(file_get_contents($destinationFile2));
$compare2 = removeCarriageReturn(file_get_contents($compareFile2));
$t->is($content2, $compare2, 'Generated command config file content is correct');
$fs->rmdir($configDir, true);
예제 #9
0
파일: unit.php 프로젝트: nubee/bee
<?php

require_once dirname(__FILE__) . '/../../lib/core/autoload/nbAutoload.php';
$autoload = nbAutoload::getInstance();
$autoload->register();
$autoload->addDirectory('vendor/', '*.php', true);
$autoload->addDirectory('lib/', '*.php', true);
$autoload->addDirectory('test/lib/', '*.php', true);
// Configures bee variables
$configParser = new nbYamlConfigParser();
nbConfig::set('nb_bee_dir', dirname(__FILE__) . '/../..');
nbConfig::set('nb_config_dir', nbConfig::get('nb_bee_dir') . '/config');
nbConfig::set('nb_test_config_dir', dirname(__FILE__) . '/../config/');
$configParser->parseFile(nbConfig::get('nb_bee_dir') . '/.bee/config.yml', '', true);
$configParser->parseFile(nbConfig::get('nb_config_dir') . '/config.yml', '', true);
$configParser->parseFile(nbConfig::get('nb_test_config_dir') . '/config.yml', '', true);
$serviceContainer = new sfServiceContainerBuilder();
$serviceContainer->register('pluginLoader', 'nbPluginLoader')->addArgument(nbConfig::get('nb_plugins_dir'))->addArgument(new sfServiceReference('commandLoader'))->setShared(true);
$serviceContainer->register('commandLoader', 'nbCommandLoaderWithReset')->setShared(true);
$output = new nbConsoleOutput();
$logger = nbLogger::getInstance();
$logger->setOutput($output);
예제 #10
0
파일: bee.php 프로젝트: nubee/bee
<?php

require_once dirname(__FILE__) . '/lib/core/autoload/nbAutoload.php';
$autoload = nbAutoload::getInstance();
$autoload->register();
$autoload->addDirectory(dirname(__FILE__) . '/lib/', '*.php', true);
$autoload->addDirectory(dirname(__FILE__) . '/vendor/', '*.php', true);
$beeDir = nbFileSystem::sanitizeDir(dirname(__FILE__));
nbConfig::set('nb_bee_dir', $beeDir);
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
    nbConfig::set('nb_user_dir', getenv('APPDATA') . '/.bee');
} else {
    nbConfig::set('nb_user_dir', getenv('HOME') . '/.bee');
}
nbConfig::set('nb_user_config', nbConfig::get('nb_user_dir') . '/config.yml');
$yaml = new nbYamlConfigParser();
$yaml->parseFile(nbConfig::get('nb_bee_dir') . '/config/config.yml', '', true);
if (file_exists(nbConfig::get('nb_user_config'))) {
    $yaml->parseFile(nbConfig::get('nb_user_config'), '', true);
}
if (file_exists('.bee/config.yml')) {
    $yaml->parseFile('.bee/config.yml', '', true);
}
if (file_exists('./.bee/' . nbConfig::get('nb_project_config'))) {
    $projectConfigurationFile = './.bee/' . nbConfig::get('nb_project_config');
} else {
    if (file_exists('./' . nbConfig::get('nb_project_config'))) {
        $projectConfigurationFile = './' . nbConfig::get('nb_project_config');
    } else {
        if (file_exists(nbConfig::get('nb_bee_dir') . '/' . nbConfig::get('nb_project_config'))) {
            $projectConfigurationFile = nbConfig::get('nb_bee_dir') . '/' . nbConfig::get('nb_project_config');
예제 #11
0
try {
    $checker->checkConfigFile($templateFileNotExists, $configFileOk);
    $t->fail('No template file to check exists');
} catch (Exception $e) {
    $t->pass('No template file to check exists');
}
try {
    $checker->checkConfigFile($templateFile, $dirNotExists);
    $t->fail('No directory exists (and it should be)');
} catch (Exception $e) {
    $t->pass('No directory exists (and it should be)');
}
try {
    $checker->checkConfigFile($templateFile, $fileNotExists);
    $t->fail('No file exists (and it should be)');
} catch (Exception $e) {
    $t->pass('No file exists (and it should be)');
}
$t->comment(' 5. Check whole configuration');
nbConfig::set('app_required_field', 'value');
try {
    $checker->check($templateFile, nbConfig::getConfiguration());
    $t->fail('Whole configuration without required fields not checked successfully');
} catch (Exception $e) {
    $t->pass('Whole configuration without required fields not checked successfully');
}
$t->ok($checker->hasErrors(), 'Configuration has errors');
$t->is(count($checker->getErrors()), 1, 'Configuration has 1 error');
nbConfig::set('app_required_child_field', 'value');
$checker->check($templateFile, nbConfig::getConfiguration());
$t->ok(!$checker->hasErrors(), 'Configuration has no errors');
예제 #12
0
if (php_uname('s') == 'Linux') {
    //test setup
    $testDir1 = $sandboxDir . '/list-item-1';
    $testDir2 = $sandboxDir . '/list-item-2';
    $dirname = '/dirname';
    $filename = '/filename';
    $fileSystem->mkdir($testDir1 . $dirname, true);
    $fileSystem->touch($testDir1 . $filename);
    $fileSystem->mkdir($testDir2 . $dirname, true);
    $fileSystem->touch($testDir2 . $filename);
    $t = new lime_test(7);
    $cmd = new nbMultiChangeModeCommand();
    nbConfig::set('test_dir_1', $testDir1);
    nbConfig::set('test_dir_2', $testDir2);
    nbConfig::set('dir_mode', '766');
    nbConfig::set('file_mode', '744');
    $commandLine = sprintf('%s --doit', $listFile);
    $t->ok($cmd->run(new nbCommandLineParser(), $commandLine), 'Folder mode changed successfully');
    $t->is($fileSystem->formatPermissions($testDir1), 'drwxrw-rw-');
    $t->is($fileSystem->formatPermissions($testDir1 . $dirname), 'drwxrw-rw-');
    $t->is($fileSystem->formatPermissions($testDir1 . $filename), '-rwxr--r--');
    $t->is($fileSystem->formatPermissions($testDir2), 'drwxrw-rw-');
    $t->is($fileSystem->formatPermissions($testDir2 . $dirname), 'drwxrw-rw-');
    $t->is($fileSystem->formatPermissions($testDir2 . $filename), '-rwxr--r--');
    //tear down
    $fileSystem->rmdir($testDir1, true);
    $fileSystem->rmdir($testDir2, true);
} else {
    $t = new lime_test(1);
    $cmd = new nbMultiChangeModeCommand();
    $commandLine = sprintf('%s', $listFile);
예제 #13
0
파일: nbConfigTest.php 프로젝트: nubee/bee
nbConfig::set('key2', $key2);
$t->is(nbConfig::has('key2_foo'), true, 'nbConfig::has() returns true if "key path" is present');
$t->comment('nbConfigTest - Test get');
$t->is(nbConfig::get('fake-key'), null, 'nbConfig::get() returns null if key in not present');
$t->is(nbConfig::get('fake-key', 'value'), 'value', 'nbConfig::get() returns default value if key in not present');
$t->is(nbConfig::get('key2'), $key2, 'nbConfig::get() returns an array if key has subkeys');
$t->is(nbConfig::get('key2_foo'), $key2['foo'], 'nbConfig::get() parse a "key path" and returns leaf value');
$t->comment('nbConfigTest - Test set');
nbConfig::set('bar', 'barValue');
$t->is(nbConfig::get('bar'), 'barValue', 'nbConfig::set() sets a new value for key');
nbConfig::set('bar', 'newBarValue');
$t->is(nbConfig::get('bar'), 'newBarValue', 'nbConfig::set() sets a new value for key');
nbConfig::set('bar_sub', 'subValue');
$t->is(nbConfig::get('bar'), array('sub' => 'subValue'), 'nbConfig::set() sets a new value for key');
$t->is(nbConfig::get('bar_sub'), 'subValue', 'nbConfig::set() sets a new value for key');
nbConfig::set('bar_sub2', 'subValue2');
$t->is(nbConfig::get('bar'), array('sub' => 'subValue', 'sub2' => 'subValue2'), 'nbConfig::set() sets a new value for key');
nbConfig::reset();
$t->comment('nbConfigTest - Test add');
$key1 = array('foo' => 'fooValue');
$key2 = array('bar' => 'barValue');
nbConfig::add($key1);
nbConfig::add($key2);
$t->is(nbConfig::getAll(), array('foo' => 'fooValue', 'bar' => 'barValue'), 'nbConfig::add() old and new values');
$key2 = array('bar' => 'barVal', 'bar2' => 'barValue2');
nbConfig::add($key2);
$t->is(nbConfig::getAll(), array('foo' => 'fooValue', 'bar' => 'barVal', 'bar2' => 'barValue2'), 'nbConfig::add() old and new values');
$key1 = array('foo' => 'fooVal', 'foo2' => 'fooValue2');
nbConfig::add($key1);
$t->is(nbConfig::getAll(), array('foo' => 'fooVal', 'foo2' => 'fooValue2', 'bar' => 'barVal', 'bar2' => 'barValue2'), 'nbConfig::add() old and new values');
$key2 = array('foo2' => 'fooVal2', 'bar' => 'barVal', 'bar2' => 'barValue2');
예제 #14
0
<?php

require_once dirname(__FILE__) . '/../../../bootstrap/unit.php';
//require_once dirname(__FILE__) . '/../../../data/core/command/EmptyCommand.php';
$t = new lime_test();
nbConfig::set('nb_command_dir', nbconfig::get('nb_sandbox_dir'));
nbConfig::set('nb_plugins_dir', nbconfig::get('nb_sandbox_dir'));
nbConfig::set('project_commands', array());
$t->comment('nbCommandLoaderTest - test ctor');
$commandLoader = new nbCommandLoader();
$t->is($commandLoader->getCommands()->count(), 0, '->getCommands() after ctor is empty');
$t->comment('nbCommandLoaderTest - load commands');
$commandLoader->loadCommands();
$t->is($commandLoader->getCommands()->count(), 0, '->loadCommands() has loaded 0 commands');
$commandLoader->addDir('test/data/core/command');
$commandLoader->loadCommands();
$t->is($commandLoader->getCommands()->count(), 1, '->loadCommands() has loaded 1 commands');
$t->ok($commandLoader->getCommands()->hasCommand(EmptyCommand::Name()), '->loadCommands() has loaded 1 commands');
$t->comment('nbCommandLoaderTest - load command aliases');
nbConfig::set('project_commands_namespace_aliascmd', EmptyCommand::Name());
$commandLoader->loadCommandAliases();
$t->ok($commandLoader->getCommands()->hasCommand('namespace:aliascmd'), '->loadCommandAliases() has loaded 1 alias');
nbConfig::set('nb_command_dir', 'test/data/core/command');
nbConfig::set('project_commands_default_aliascmd1', EmptyCommand::Name());
$commandLoader = new nbCommandLoader();
$commandLoader->loadCommands();
$commandLoader->loadCommandAliases();
$t->ok($commandLoader->getCommands()->hasCommand(':aliascmd1'), '->loadCommandAliases() has loaded 1 alias with no namespace');
예제 #15
0
파일: unit.php 프로젝트: nubee/bee
<?php

require_once dirname(__FILE__) . '/../../../../test/bootstrap/unit.php';
nbConfig::set('web_base_dir', 'plugins/nbWebsitePlugin/test/data');
$configParser->parseFile(dirname(__FILE__) . '/../data/config/website-deploy.yml', '', true);
$serviceContainer->pluginLoader->loadPlugins(array('nbWebsitePlugin', 'nbArchivePlugin', 'nbMysqlPlugin', 'nbFileSystemPlugin'));
$fileSystem = nbFileSystem::getInstance();
예제 #16
0
<?php

require_once dirname(__FILE__) . '/../bootstrap/unit.php';
nbConfig::set('project_type', 'symfony');
nbConfig::set('project_symfony_exec-path', dirname(__FILE__) . '/../data/stage-site/symfony');
nbConfig::set('project_symfony_test-enviroment', 'lime');
$symfonyExecPath = nbConfig::get('project_symfony_exec-path');
$symfonyTestEnviroment = nbConfig::get('project_symfony_test-enviroment');
$t = new lime_test(2);
$t->comment('Symfony Test All');
$cmd = new nbSymfonyTestAllCommand();
$t->ok($cmd->run(new nbCommandLineParser(), ''), 'Symfony project test all');
nbConfig::set('project_type', 'xxx');
$t->comment('Symfony Test All with wrong project type');
try {
    $cmd = new nbSymfonyTestAllCommand();
    $cmd->run(new nbCommandLineParser(), '');
    $t->fail('Exception for wrong project type not thrown');
} catch (Exception $e) {
    $t->pass('Exception for wrong project type');
}