public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables)
 {
     if (empty($engine->options->sutName)) {
         throw new E4xx_NoSystemUnderTestSpecified();
     }
     $injectables->initActiveSystemUnderTestConfigSupport($engine->options->sutName, $injectables);
 }
示例#2
0
 public function init(Injectables $injectables)
 {
     // we start off with the built-in config
     $this->mergeData('storyplayer', $injectables->defaultConfig);
     // these are the initial variables we want
     $this->setData('storyplayer.ipAddress', $this->getHostIpAddress());
     $this->setData('storyplayer.currentDir', getcwd());
     $this->setData('storyplayer.user.home', getenv('HOME'));
     // we also want to link in the hosts and roles tables, to make
     // it a lot easier for Prose modules
     $activeConfig = $this->getConfig();
     $runtimeConfig = $injectables->getRuntimeConfig();
     $runtimeConfigManager = $injectables->getRuntimeConfigManager();
     $testEnvName = $injectables->activeTestEnvironmentName;
     $hostsTable = $runtimeConfigManager->getTable($runtimeConfig, 'hosts');
     if (!isset($hostsTable->{$testEnvName})) {
         $hostsTable->{$testEnvName} = new BaseObject();
     }
     $activeConfig->hosts = $hostsTable->{$testEnvName};
     $rolesTable = $runtimeConfigManager->getTable($runtimeConfig, 'roles');
     if (!isset($rolesTable->{$testEnvName})) {
         $rolesTable->{$testEnvName} = new BaseObject();
     }
     $activeConfig->roles = $rolesTable->{$testEnvName};
 }
示例#3
0
 public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables)
 {
     // do we have a device to load?
     if (!isset($engine->options->device)) {
         // nothing to do
         return;
     }
     $deviceName = $engine->options->device;
     $injectables->initActiveDevice($deviceName, $injectables);
 }
 public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables)
 {
     // at this point, we are assuming that the following is all true:
     //
     // a) storyplayer.json[.dist] has been loaded
     //    >> $injectables->defaultConfig (object)
     // b) .storyplayer/test-environments/<env>.json has been loaded
     //    >> $injectables->activeTestEnvironmentConfig (TestEnvironmentConfig)
     //
     // we now want to create $injectables->activeConfig
     $injectables->initActiveConfigSupport($injectables);
     // all done
 }
 /**
  * @covers DataSift\Storyplayer\Prose\AssertsObject::__construct
  */
 public function testCanInstantiate()
 {
     // ----------------------------------------------------------------
     // setup your test
     $i = new Injectables();
     $i->initOutputSupport();
     $i->initRuntimeConfigSupport($i);
     $st = new StoryTeller($i);
     $expectedArray = array(new stdClass());
     // ----------------------------------------------------------------
     // perform the change
     $obj = new AssertsObject($st, $expectedArray);
     // ----------------------------------------------------------------
     // test the results
     $this->assertTrue($obj instanceof AssertsObject);
 }
示例#6
0
 public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables)
 {
     // create a definition for localhost
     $host = new BaseObject();
     $host->hostId = "localhost";
     $host->osName = $this->detectOs();
     $host->type = "PhysicalHost";
     $host->ipAddress = "127.0.0.1";
     $host->hostname = "localhost";
     $host->provisioned = true;
     // we need to make sure it's registered in the hosts table
     $runtimeConfigManager = $injectables->getRuntimeConfigManager();
     $runtimeConfig = $injectables->getRuntimeConfig();
     $hostsTable = $runtimeConfigManager->getTable($runtimeConfig, 'hosts');
     $testEnv = $injectables->activeTestEnvironmentName;
     if (!isset($hostsTable->{$testEnv})) {
         $hostsTable->{$testEnv} = new BaseObject();
     }
     $hostsTable->{$testEnv}->localhost = $host;
 }
示例#7
0
 /**
  *
  * @param  CliEngine   $engine
  * @param  Injectables $injectables
  * @return void
  */
 protected function initReporting(CliEngine $engine, Injectables $injectables)
 {
     // are there any reporting modules to be loaded?
     if (!isset($engine->options->reports)) {
         // no
         return;
     }
     // setup the reports that have been requested
     $injectables->initReportLoaderSupport($injectables);
     foreach ($engine->options->reports as $reportName => $reportFilename) {
         try {
             $report = $injectables->reportLoader->loadReport($reportName, ['filename' => $reportFilename]);
         } catch (E4xx_NoSuchReport $e) {
             $injectables->output->logCliError("no such report '{$reportName}'");
             exit(1);
         }
         $injectables->output->usePluginInSlot($report, $reportName);
     }
     // all done
 }
示例#8
0
 /**
  * @covers DataSift\Storyplayer\CommandLib\SshClient::convertParamsForUse
  */
 public function testCanEscapeParamsForRemoteGlobbing()
 {
     // ----------------------------------------------------------------
     // setup your test
     $i = new Injectables();
     $i->initOutputSupport();
     $i->initDataFormatterSupport();
     $i->initRuntimeConfigSupport($i);
     $st = new StoryTeller($i);
     $obj = new SshClient($st);
     $inputParams = "ls *";
     $expectedParams = "ls '*'";
     // ----------------------------------------------------------------
     // perform the change
     $actualParams = $obj->convertParamsForUse($inputParams);
     // ----------------------------------------------------------------
     // test the results
     $this->assertEquals($expectedParams, $actualParams);
 }
 public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables)
 {
     $injectables->initProseLoaderSupport($injectables);
 }
 public function initBeforeModulesAvailable(CliEngine $engine, CliCommand $command, Injectables $injectables)
 {
     $injectables->initActiveTestEnvironmentConfigSupport($engine->options->testEnvironmentName, $injectables);
 }
示例#11
0
 public function __construct(Injectables $injectables)
 {
     // remember our output object
     $this->setOutput($injectables->output);
     // our data formatter
     $this->setDataFormatter($injectables->dataFormatter);
     // set a default page context
     $this->setPageContext(new PageContext());
     // create the actionlog
     $this->setActionLogger(new Action_Logger($injectables));
     // create an empty checkpoint
     $this->setCheckpoint(new Story_Checkpoint($this));
     // create our Prose Loader
     $this->setProseLoader($injectables->proseLoader);
     // create our Phase Loader
     $this->setPhaseLoader($injectables->phaseLoader);
     // remember the device we are testing with
     $this->setDevice($injectables->activeDeviceName, $injectables->activeDevice);
     // the config that we have loaded
     $this->setConfig($injectables->activeConfig);
     // our runtime config
     $this->setRuntimeConfig($injectables->getRuntimeConfig());
     $this->setRuntimeConfigManager($injectables->getRuntimeConfigManager());
     self::$self = $this;
 }