public function testUpgradeLifeCycleAutomaticWithTest()
 {
     $template = new TemplateModel($this->_template->exportData());
     $template->importData(Zend_Json::decode(self::LIFE_CYCLE_AUTOMATIC_WITH_TESTS));
     $lifeCycle = App_MigrationTool_TemplatesTo24_LifeCycleUtils::upgradeLifeCycle($template);
     $this->assertInstanceOf('Application\\Model\\LifeCycleModel', $lifeCycle);
     $status = $lifeCycle->getStatusByOriginStatus(LifeCycleModel::STATUS_ACTIVATION_READY);
     $this->assertInstanceOf('Application\\Model\\LifeCycle\\StatusModel', $status);
     $trasition = $status->getTransitionByDestinationStatus(LifeCycleModel::STATUS_ACTIVE);
     $this->assertInstanceOf('Application\\Model\\LifeCycle\\TransitionModel', $trasition);
     $this->assertTrue($trasition->manual);
     $validator = new LifeCycleAutomaticWithTest();
     $this->assertTrue($validator->isValid($lifeCycle), var_export($validator->getMessages(), 1));
 }
 public function testUpgradeTariffPlanLifeCycle()
 {
     $template = new TemplateModel($this->_template->exportData());
     $template->importData(Zend_Json::decode(self::LIFE_CYCLE_TARIFF));
     $tariff = App_MigrationTool_TemplatesTo24_LifeCycleTariffUtils::upgradeTariffPlanLifeCycle($template);
     $this->assertInstanceOf('Application\\Model\\TariffPlanLifeCycleModel', $tariff);
     $status = $tariff->findStatus(LifeCycleModel::STATUS_ACTIVATION_READY);
     $this->assertInstanceOf('Application\\Model\\TariffPlan\\StatusCostModel', $status);
     $this->assertEquals(0, $status->cost);
     $status = $tariff->findStatus(LifeCycleModel::STATUS_ACTIVATION_PENDANT);
     $this->assertInstanceOf('Application\\Model\\TariffPlan\\StatusCostModel', $status);
     $this->assertEquals(0, $status->cost);
     $validator = new TariffPlanLifeCycleValidate();
     $this->assertTrue($validator->isValid($tariff), var_export($validator->getMessages(), 1));
 }
 public static function upgradeTariffPlanTemplate($id, $orgId, $tariffPlan)
 {
     $template = new TemplateModel();
     $template->id = $id;
     $template->organizationId = $orgId;
     $template->type = 'tariffPlanService';
     $template->description = $tariffPlan->name;
     $template->importData($tariffPlan->exportData());
     return $template;
 }