#!/usr/bin/env php <?php /** * Script to upgrade tariff templates */ require_once realpath(dirname(__FILE__) . '/lib/Cli.php'); $cli = new Cli(array('file|f=s' => 'Path to zone upgrading file. REQUIRED', 'zoneNamesfile|n=s' => 'Path to zone names file.', 'orgId|o=s' => 'Organization where upgrade tariff templates. If it is not defined it will try to use the name of file as orgId', 'separator|s=s' => "Separator of file data. Defautl \"\t\" [TAB]")); try { $logs = array(); App_MigrationTool_TemplatesTo20_ServiceTariffUtils::performUpgrade($cli->getOption('o'), $cli->getOption('f'), $cli->getOption('n'), $cli->getOption('s'), $logs); foreach ($logs as $line) { echo $line . "\n"; } } catch (Exception $e) { echo 'AN ERROR HAS OCCURRED:' . PHP_EOL; echo $e->getMessage() . PHP_EOL; foreach ($logs as $line) { echo $line . "\n"; } exit(1); } // generally speaking, this script will be run from the command line exit(0);
/** * @expectedException App_MigrationTool_TemplatesTo20_Exception */ public function testUpgradeTariffPlanFailZoneDoesNotExist() { $relations = array(); $zonePlan = App_MigrationTool_TemplatesTo20_ServiceTariffUtils::createZonePlan($this->_zoneData, $this->_zoneNamesData, $relations); $data = Zend_Json::decode($this->_oldTemplateData); $data['origVoice'][0]['zoneId'] = "25"; $template = new TemplateModel($data); $template->organizationId = self::PROVIDER_ENABLER_ORG_ID; $tariffPlan = App_MigrationTool_TemplatesTo20_ServiceTariffUtils::upgradeTariffPlan($template, $zonePlan, $relations); }