Example #1
0
 /**
  * {@inheritdoc}
  * @see TestDataFixtures::prepareTestData()
  */
 public function prepareTestData()
 {
     if (!empty($this->sets[static::TEST_DATA_FARM_ROLES])) {
         foreach ($this->sets[static::TEST_DATA_FARM_ROLES] as &$frData) {
             /* @var $farmRole FarmRole */
             $farmRole = ApiV2Test::createEntity(new FarmRole(), $frData);
             /* @var $settings SettingsCollection */
             $settings = $farmRole->settings;
             $settings->saveSettings([FarmRoleSetting::AWS_INSTANCE_TYPE => 't1.micro', FarmRoleSetting::AWS_AVAIL_ZONE => 'us-east-1d', FarmRoleSetting::SCALING_ENABLED => true, FarmRoleSetting::SCALING_MIN_INSTANCES => 1, FarmRoleSetting::SCALING_MAX_INSTANCES => 2]);
             $frData['farmRoleId'] = $farmRole->id;
         }
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  * @see TestDataFixtures::prepareTestData()
  */
 public function prepareTestData()
 {
     if (!empty($this->sets[static::TEST_DATA_COST_CENTERS])) {
         foreach ($this->sets[static::TEST_DATA_COST_CENTERS] as &$ccData) {
             $ccData['accountId'] = self::$user->getAccountId();
             $ccData['envId'] = self::$env->id;
             /* @var $cc CostCentreEntity */
             $cc = ApiV2Test::createEntity(new CostCentreEntity(), $ccData, 2);
             $cc->saveProperty(CostCentrePropertyEntity::NAME_BILLING_CODE, $ccData['billingCode']);
             $cc->save();
             $ccData['id'] = $cc->ccId;
             ApiV2Test::createEntity(new AccountCostCenterEntity(), ['ccId' => $ccData['id'], 'accountId' => $ccData['accountId']], 1);
             // to delete Cost Center properties
             ApiV2Test::toDelete(CostCentrePropertyEntity::class, [$cc->ccId, $cc->getProperty(CostCentrePropertyEntity::NAME_BILLING_CODE)]);
         }
     }
 }
Example #3
0
 /**
  * {@inheritdoc}
  * @see TestDataFixtures::prepareTestData()
  */
 public function prepareTestData()
 {
     if (!empty($this->sets[static::TEST_DATA_PROJECTS])) {
         $ccId = Scalr_Environment::init()->loadById(static::$env->id)->getPlatformConfigValue(Scalr_Environment::SETTING_CC_ID);
         foreach ($this->sets[static::TEST_DATA_PROJECTS] as &$projectData) {
             $projectData['envId'] = self::$env->id;
             $projectData['accountId'] = self::$user->getAccountId();
             $projectData['createdById'] = self::$user->id;
             $projectData['createdByEmail'] = self::$user->email;
             $projectData['ccId'] = $ccId;
             /* @var $project ProjectEntity */
             $project = ApiV2Test::createEntity(new ProjectEntity(), $projectData);
             $project->setCostCenter(\Scalr::getContainer()->analytics->ccs->get($projectData['ccId']));
             $project->saveProperty(ProjectPropertyEntity::NAME_BILLING_CODE, $projectData['name']);
             $project->save();
             $projectData['projectId'] = $project->projectId;
             // to Delete project Properties
             ApiV2Test::toDelete(ProjectPropertyEntity::class, [$project->projectId, $project->getProperty(ProjectPropertyEntity::NAME_BILLING_CODE)]);
         }
     }
 }