public function testValidateServicePackNotExists()
 {
     $servicePack = new ServicePackModel($this->_data);
     ServicePackMapper::getInstance()->insert($servicePack);
     $this->_servicePackIdToDelete = $servicePack->getId();
     $result = $this->_validator->isValid($servicePack->getId());
     $this->assertTrue($result);
 }
 public function setUp()
 {
     parent::setUp();
     $this->_spMapper = \Application\Model\Mapper\ServicePackMapper::getInstance();
     $this->_lfMapper = \Application\Model\Mapper\LifeCycleMapper::getInstance();
     $this->_restMapper = \Application\Model\Mapper\RestrictionMapper::getInstance();
     $this->_tflcMapper = \Application\Model\Mapper\TariffPlanLifeCycleMapper::getInstance();
     $this->_tfservMapper = \Application\Model\Mapper\TariffPlanServicesMapper::getInstance();
     $this->_servicePackData = array("name" => "SPTesting" . "-" . microtime(true), "description" => "A service pack for integration test", "currency" => self::CURRENCY, "changeCost" => 3000, "whiteList" => array("34696*", "34697*", "34695777888"), "blackList" => array("34666*", "34677*", "34655777888"), "roamingList" => array("34666*", "34677*", "34655777888"), "listsLocked" => true);
     $this->_lifeCycleData = array("name" => "LifeCycle" . "-" . microtime(true), "description" => "LifeCycle for integration tests", "status" => array(array('status' => LifeCycleModel::STATUS_INACTIVE_NEW, 'timer' => 100, 'transitions' => array(array('destinationStatus' => LifeCycleModel::STATUS_TEST, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_SUSPENDED, 'manual' => true, 'automatic' => true, 'automaticInfo' => array('timerCause' => true, 'firstUseCause' => false, 'voucherCause' => false)))), array('status' => LifeCycleModel::STATUS_TEST, 'vouchers' => array('voice' => array('home' => 234)), 'transitions' => array(array('destinationStatus' => LifeCycleModel::STATUS_ACTIVATION_READY, 'manual' => true, 'automatic' => true, 'automaticInfo' => array('timerCause' => false, 'firstUseCause' => false, 'voucherCause' => true, 'voucherCauseInfo' => array('type' => Model\LifeCycle\VoucherCauseInfoModel::CAUSE_TYPE_ANY, 'vouchers' => array(Model\LifeCycle\VoucherCauseInfoModel::VOUCHER_TYPE_VOICE_HOME)))), array('destinationStatus' => LifeCycleModel::STATUS_SUSPENDED, 'manual' => true, 'automatic' => false))), array('status' => LifeCycleModel::STATUS_ACTIVATION_READY, 'transitions' => array(array('destinationStatus' => LifeCycleModel::STATUS_ACTIVE, 'manual' => false, 'automatic' => true, 'automaticInfo' => array('timerCause' => false, 'firstUseCause' => true, 'voucherCause' => false)), array('destinationStatus' => LifeCycleModel::STATUS_SUSPENDED, 'manual' => true, 'automatic' => false))), array('status' => LifeCycleModel::STATUS_ACTIVE, 'transitions' => array(array('destinationStatus' => LifeCycleModel::STATUS_DEACTIVATED, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_SUSPENDED, 'manual' => true, 'automatic' => false))), array('status' => LifeCycleModel::STATUS_DEACTIVATED, 'transitions' => array(array('destinationStatus' => LifeCycleModel::STATUS_ACTIVE, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_SUSPENDED, 'manual' => true, 'automatic' => false))), array('status' => LifeCycleModel::STATUS_SUSPENDED, 'transitions' => array(array('destinationStatus' => LifeCycleModel::STATUS_DEACTIVATED, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_ACTIVE, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_ACTIVATION_READY, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_TEST, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_INACTIVE_NEW, 'manual' => true, 'automatic' => false), array('destinationStatus' => LifeCycleModel::STATUS_RETIRED, 'manual' => true, 'automatic' => false))), array('status' => LifeCycleModel::STATUS_RETIRED)));
     $this->_restrictionsData = array('name' => "RestTest" . "-" . microtime(true), 'description' => "Restrinctions for integration test", 'operator' => array(self::OPERATOR), 'voice' => array('mo' => array('home' => true, 'roaming' => true, 'international' => true), 'mt' => array('home' => true, 'roaming' => true, 'international' => true)), 'sms' => array('mo' => array('home' => true, 'roaming' => true, 'international' => true), 'mt' => array('home' => true, 'roaming' => true, 'international' => true)), 'data' => array('home' => false, 'roaming' => false));
     $this->_lifeCycleTariffPlanData = array('name' => "LCTPlantesting" . "-" . microtime(true), 'description' => "LifeCycle TariffPlan for integration tests", 'status' => array(array('status' => LifeCycleModel::STATUS_ACTIVE, 'cost' => 20), array('status' => LifeCycleModel::STATUS_DEACTIVATED, 'cost' => 120)), 'transitions' => array(array('statusStart' => LifeCycleModel::STATUS_INACTIVE_NEW, 'statusFinal' => LifeCycleModel::STATUS_ACTIVATION_READY, 'cost' => 12), array('statusStart' => LifeCycleModel::STATUS_INACTIVE_NEW, 'statusFinal' => LifeCycleModel::STATUS_TEST, 'cost' => 12), array('statusStart' => LifeCycleModel::STATUS_INACTIVE_NEW, 'statusFinal' => LifeCycleModel::STATUS_ACTIVATION_PENDANT, 'cost' => 12), array('statusStart' => LifeCycleModel::STATUS_DEACTIVATED, 'statusFinal' => LifeCycleModel::STATUS_ACTIVE, 'cost' => 12), array('statusStart' => LifeCycleModel::STATUS_SUSPENDED, 'statusFinal' => LifeCycleModel::STATUS_RETIRED, 'cost' => 12)));
     $this->_servicesTariffPlanData = array('name' => "STPlanTesting" . "-" . microtime(true), 'description' => "Services TariffPlan for integration tests", 'defaultData' => array("t2N" => 7, "t2Q" => 8, 'pool' => true), 'data' => array(array('zoneId' => self::ZONE_ID_2, 'destinationId' => self::DESTINATION_ID_2, 'n1' => 1, "n2" => 2, "n3" => 3, "n4" => 4, "n5" => 5, "q1" => 6, "t2N" => 7, "t2Q" => 8, "t4N" => 9, "t4Q" => 10, "t6N" => 11, "t6Q" => 12, 'pool' => true)), 'defaultOrigVoice' => array("t2N" => 7, "t2Q" => 8, 'pool' => true), 'origVoice' => array(array('zoneId' => self::ZONE_ID_2, 'destinationId' => self::DESTINATION_ID_2, "t2N" => 7, "t2Q" => 8, 'pool' => true)), 'defaultTermVoice' => array("t2N" => 7, "t2Q" => 8, 'pool' => true), 'termVoice' => array(array('zoneId' => self::ZONE_ID_1, 'destinationId' => self::DESTINATION_ID_1, "t2N" => 7, "t2Q" => 8, 'pool' => true)), 'defaultSms' => array("t2N" => 1, "t2Q" => 2, 'pool' => true), 'sms' => array(array('zoneId' => self::ZONE_ID_2, 'destinationId' => self::DESTINATION_ID_2, "t2N" => 7, "t2Q" => 8, 'pool' => true)));
 }
 public function delete($id)
 {
     if (!$id instanceof CommercialGroupModel) {
         $item = $this->findOneById($id);
     } else {
         $item = $id;
     }
     ServicePackMapper::getInstance()->getCache()->remove($item->servicePackId);
     return parent::delete($id);
 }