DataSift\Storyplayer\DefinitionLib\TestEnvironment_Definition::getConfig PHP Method

getConfig() public method

IMPORTANT: we make sure that the data we return is a read-only copy of our definition. At the time of writing, we're not sure if other parts of SPv2 will break as a result.
public getConfig ( ) : DataSift\Stone\ObjectLib\BaseObject
return DataSift\Stone\ObjectLib\BaseObject
    public function getConfig()
    {
        // the config that we will return to the caller
        $retval = new BaseObject();
        // first things first ... who are we?
        $retval->name = $this->getName();
        // let's get the groups built
        $retval->groups = [];
        foreach ($this->groups as $groupDef) {
            $groupConfig = new BaseObject();
            $groupConfig->type = $groupDef->getGroupType();
            $groupConfig->details = new BaseObject();
            $groupConfig->details->machines = $groupDef->getHostsAsConfig();
            if ($groupDef->hasProvisioningAdapters()) {
                $groupConfig->provisioning = $groupDef->getProvisioningAsConfig();
            }
            $groupConfig->baseFolder = $groupDef->getBaseFolder();
            $retval->groups[] = $groupConfig;
        }
        // do we have any module settings to carry over?
        if ($this->hasModuleSettings()) {
            $retval->moduleSettings = new BaseObject();
            $retval->moduleSettings->mergeFrom($this->getModuleSettings());
        }
        // all done
        return $retval;
    }

Usage Example

Example #1
0
 /**
  *
  * @param  Injectables $injectables
  * @param  \DataSift\Storyplayer\TestEnvironmentsLib\TestEnvironmentsConfig|\DataSift\Storyplayer\DefinitionLib\TestEnvironment_Definition $envConfig
  * @return void
  */
 public function mergeTestEnvironmentConfig($injectables, $envConfig = null)
 {
     // do we have a test environment?
     if (!isset($injectables->activeTestEnvironmentName) || $envConfig === null) {
         $this->setData('target', null);
         return;
     }
     // we want to remember the name of the test environment
     $this->setData('target.name', $injectables->activeTestEnvironmentName);
     // merge in the loaded config
     $this->mergeData('target', $envConfig->getConfig());
 }