コード例 #1
0
 public function testRepeatedNumberExtra()
 {
     $old_srv = \Application\Service\SupplServicesService::getInstance();
     $data = array('applicationOriginatedSms' => SupplServicesModel::ST_ACTIVATED, 'published' => SupplServicesModel::STATUS_PUBLISHED, 'customerId' => 1, 'applicationOriginatedSmsMsisdn' => '346777888212', 'additionalMsisdn' => array(array('msisdn' => '346777888012', 'description' => 'Previous', 'supplServicesId' => '1')));
     \Application\Service\SupplServicesService::setInstance(new FakeService($data));
     $msisdnData = array("supplServicesId" => "1", "msisdn" => "346777888012", "description" => "Test descrip");
     $smsMsisdn = new SmsMsisdnModel($msisdnData);
     $this->assertFalse($this->_validator->isValid($smsMsisdn));
     $this->assertEquals(array('msisdn' => array('numberRepeated' => "346777888012 number is repeated")), $this->_validator->getMessages());
     \Application\Service\SupplServicesService::setInstance($old_srv);
 }
コード例 #2
0
    public function testAllDataTariff()
    {
        $this->_user = $this->_createAuthUser(array('userName' => 'TariffPlanUserTest', 'organizationId' => self::PROVIDER_COMMERCIAL_ORG_ID));
        $json = '{
    "id": "",
    "name": "BSPA6",
    "description": "Just a description...",
    "published": "",
    "customers": "",
    "serviceProviderId": "",
    "serviceProviderName": "",
    "currency": "",
    "tariffPlanServicesId": "",
    "tariffPlanServicesName": "",
    "tariffPlanLifeCycleId": "",
    "tariffPlanLifeCycleName": "",
    "lifeCycleId": "",
    "lifeCycleName": "",
    "modified": false,
    "listsLocked": true,
    "whiteList": [],
    "blackList": [],
    "roamingList": [],
    "restrictions": {
        "id": "352",
        "serviceProviderId": "provider-ORG_SRVPROVIDER135aa5298cf7qRjXt",
        "name": "1331810308.9193",
        "description": "description",
        "voice": {
            "mo": {
                "home": true,
                "roaming": true,
                "international": true
            },
            "mt": {
                "home": true,
                "roaming": true,
                "international": false
            }
        },
        "sms": {
            "mo": {
                "home": true,
                "roaming": true,
                "international": true
            },
            "mt": {
                "home": true,
                "roaming": true,
                "international": false
            }
        },
        "data": {
            "home": true,
            "roaming": true,
            "international": false
        },
        "type": "",
        "organizationId": "",
        "operator": []
    },
    "lifeCycle": {
        "name": "name",
        "description": "description",
        "status": [
            {
                "status": "INACTIVE_NEW",
                "transitions": [
                    {
                        "destinationStatus": "TEST",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "SUSPENDED",
                        "manual": true,
                        "automatic": true,
                        "automaticInfo": {
                            "timerCause": true,
                            "firstUseCause": false,
                            "voucherCause": false
                        }
                    }
                ],
                "timer": 60
            },
            {
                "status": "TEST",
                "transitions": [
                    {
                        "destinationStatus": "SUSPENDED",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "manual": true,
                        "automatic": false,
                        "destinationStatus": "ACTIVATION_READY"
                    }
                ],
                "vouchers": {
                    "data": {
                        "home": 33792
                    },
                    "voice": {},
                    "sms": {}
                }
            },
            {
                "status": "ACTIVATION_READY",
                "transitions": [
                    {
                        "destinationStatus": "ACTIVE",
                        "manual": false,
                        "automatic": true,
                        "automaticInfo": {
                            "timerCause": false,
                            "firstUseCause": true,
                            "voucherCause": false
                        }
                    },
                    {
                        "destinationStatus": "SUSPENDED",
                        "manual": true,
                        "automatic": false
                    }
                ]
            },
            {
                "status": "ACTIVE",
                "transitions": [
                    {
                        "destinationStatus": "DEACTIVATED",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "SUSPENDED",
                        "manual": true,
                        "automatic": false
                    }
                ]
            },
            {
                "status": "DEACTIVATED",
                "transitions": [
                    {
                        "destinationStatus": "ACTIVE",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "SUSPENDED",
                        "manual": true,
                        "automatic": false
                    }
                ]
            },
            {
                "status": "SUSPENDED",
                "transitions": [
                    {
                        "destinationStatus": "INACTIVE_NEW",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "ACTIVE",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "DEACTIVATED",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "RETIRED",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "TEST",
                        "manual": true,
                        "automatic": false
                    },
                    {
                        "destinationStatus": "ACTIVATION_READY",
                        "manual": true,
                        "automatic": false
                    }
                ]
            },
            {
                "status": "RETIRED"
            }
        ],
        "id": "",
        "type": "lifeCycle"
    },
    "tariffPlanServices": {
        "id": "",
        "type": "",
        "name": "FromTemplate",
        "description": "",
        "currency": "978",
        "defaultOrigVoice": {
            "pool": false,
            "t2N": 1,
            "t2S": 0,
            "t2Q": 0
        },
        "origVoice": [],
        "defaultTermVoice": {
            "pool": false,
            "t2N": 1,
            "t2S": 0,
            "t2Q": 0
        },
        "termVoice": [],
        "defaultSms": {
            "pool": false,
            "t2N": 1,
            "t2Q": 0
        },
        "sms": [],
        "defaultData": {
            "pool": false,
            "t6Q": 0,
            "t6N": 1048576
        },
        "data": [],
        "modified": false
    },
    "tariffPlanLifeCycle": {
        "name": "1331810308.3954",
        "description": "description",
        "status": [
            {
                "status": "ACTIVE",
                "cost": 0
            },
            {
                "status": "DEACTIVATED",
                "cost": 0
            }
        ],
        "transitions": [
            {
                "statusStart": "INACTIVE_NEW",
                "statusFinal": "ACTIVATION_READY",
                "cost": 0
            },
            {
                "statusStart": "INACTIVE_NEW",
                "statusFinal": "TEST",
                "cost": 0
            },
            {
                "statusStart": "INACTIVE_NEW",
                "statusFinal": "ACTIVATION_PENDANT",
                "cost": 0
            },
            {
                "statusStart": "DEACTIVATED",
                "statusFinal": "ACTIVE",
                "cost": 0
            },
            {
                "statusStart": "SUSPENDED",
                "statusFinal": "RETIRED",
                "cost": 0
            }
        ],
        "id": "514",
        "modified": false,
        "type": "",
        "currencyId": "978",
        "lifeCycleId": "514",
        "lifeCycleName": "1331810308.3954"
    }
}';
        $data = Zend_Json::decode($json);
        $sp = new Model\ServicePackModel($data);
        $validator = new Validate\LifeCycleValidate();
        $this->assertTrue($validator->isValid($sp->getLifeCycle()));
    }
コード例 #3
0
 public function testInvalidName()
 {
     $data = array("name" => "", "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)));
     $lifeCycle = new LifeCycleModel($data);
     $this->assertFalse($this->_validateCollection->isValid($lifeCycle));
 }
コード例 #4
0
 public function testRepeatedGroupName()
 {
     $data = array("id" => 1, "name" => "ZonePlan Test Deleted", "published" => ServicePackModel::STATUS_PUBLISHED, "zoneGroups" => array(array('id' => 1, 'name' => 'group_1', 'zones' => array(1, 2)), array('id' => 3, 'name' => 'group_1', 'zones' => array(1, 2))));
     $zonePlan = new ZonePlanModel($data);
     $this->assertFalse($this->_validator->isValid($zonePlan));
 }