コード例 #1
0
 public function testExportOrgData()
 {
     $org = new Organization\OrgMasterModel($this->_data);
     $array = $org->exportData();
     $this->assertTrue(is_array($array));
     $this->assertEquals($this->_data, $array);
 }
コード例 #2
0
 public function testExportOrgData()
 {
     $this->markTestIncomplete();
     // TODO: Shouldn't this be OrgEndUserModel????
     $org = new Organization\OrgMasterModel($this->_data);
     $array = $org->exportData();
     $this->assertTrue(is_array($array));
     $this->assertEquals($this->_data, $array);
 }
コード例 #3
0
 public function tearDown()
 {
     if ($this->_org && $this->_org->getId()) {
         $this->_org->delete();
     }
     if ($this->_user && $this->_user->getId()) {
         $this->_user->delete();
     }
     if ($this->_service && $this->_user && $this->_user->getUserName()) {
         $user = $this->_service->loadByUsername($this->_user->getUserName());
         if (!is_null($user)) {
             $user->delete();
         }
     }
 }
コード例 #4
0
 public function testDelete()
 {
     $this->_parentModel->save();
     $this->_addUser(OrganizationMapper::cleanOrgId($this->_parentModel->getId()), OrgMasterModel::ORG_TYPE);
     $this->_model->setParentId($this->_parentModel->getId());
     $this->_model->save();
     $this->_mapper->delete($this->_model->getId());
     $provider = $this->_mapper->findOneById($this->_model->getId());
     $this->assertNull($provider);
 }
コード例 #5
0
 protected function _createTree()
 {
     if ($this->_masterOrg && $this->_masterOrg instanceof Model\PersistentAbstract && $this->_masterOrg->getId()) {
         $this->_masterOrg->delete();
     }
     if ($this->_providerOrg && $this->_providerOrg instanceof Model\PersistentAbstract && $this->_providerOrg->getId()) {
         $this->_providerOrg->delete();
     }
     $this->_masterOrg = new Model\Organization\OrgMasterModel(array('name' => 'ORG_TEST' . microtime(true), 'description' => "Description", 'status' => Model\Organization\OrgMasterModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => 'es', 'primaryContact' => array('firstName' => 'pcfn', 'lastName' => 'pcln', 'phone' => '933453212', 'email' => '*****@*****.**', 'mobile' => '665348765', 'fax' => '933453232'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalunya', 'region' => 'Barcelona', 'country' => 'ES', 'postalCode' => '08005')));
     $this->_masterOrg->save();
     $this->_providerOrg = new Model\Organization\OrgServiceProviderModel(array('name' => 'Service provider name' . microtime(true), 'description' => "Description", 'commercialName' => 'Service provider commercial name', 'status' => Model\Organization\OrgServiceProviderModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => 'es', 'parentId' => $this->_masterOrg->getId(), 'GGSNProvisioning' => true, 'pluralSIMProvisioning' => false, 'fiscalNumber' => 'X4543545643', 'countryVATNumber' => '45634556', 'brand' => 'o2', 'primaryContact' => array('firstName' => 'Pepe', 'lastName' => 'González', 'phone' => '934443344', 'email' => '*****@*****.**', 'mobile' => '655445533', 'fax' => '934443344'), 'billingAddress' => array('line1' => 'name line here', 'line2' => 'name line here', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'shippingAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080')));
     $this->_providerOrg->save();
     return $this->_providerOrg->getId();
 }
コード例 #6
0
 /**
  * @expectedException \Application\Model\Mapper\Exception\EricssonException
  */
 public function testUpdateNonExistingOrganization()
 {
     $this->_org->setId('noexists-12312312312');
     $this->_mapper->update($this->_org);
 }
コード例 #7
0
 protected function _createTree()
 {
     if ($this->_masterOrg && $this->_masterOrg instanceof Model\PersistentAbstract && $this->_masterOrg->getId()) {
         $this->_masterOrg->delete();
     }
     if ($this->_providerOrg && $this->_providerOrg instanceof Model\PersistentAbstract && $this->_providerOrg->getId()) {
         $this->_providerOrg->delete();
     }
     if ($this->_customerOrg && $this->_customerOrg instanceof Model\PersistentAbstract && $this->_customerOrg->getId()) {
         $this->_customerOrg->delete();
     }
     $this->_masterOrg = new Model\Organization\OrgMasterModel(array('name' => 'ORG_TEST' . microtime(true), 'description' => "Description", 'status' => Model\Organization\OrgMasterModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => 'es', 'primaryContact' => array('firstName' => 'pcfn', 'lastName' => 'pcln', 'phone' => '933453212', 'email' => '*****@*****.**', 'mobile' => '665348765', 'fax' => '933453232'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalunya', 'region' => 'Barcelona', 'country' => 'ES', 'postalCode' => '08005')));
     $this->_masterOrg->save();
     $this->_providerOrg = new Model\Organization\OrgServiceProviderModel(array('name' => 'Service provider name' . microtime(true), 'description' => "Description", 'commercialName' => 'Service provider commercial name', 'status' => Model\Organization\OrgServiceProviderModel::ORG_STATUS_ACTIVATED, 'defaultLanguage' => 'es', 'parentId' => $this->_masterOrg->getId(), 'GGSNProvisioning' => true, 'pluralSIMProvisioning' => false, 'fiscalNumber' => 'X4543545643', 'countryVATNumber' => '45634556', 'brand' => 'o2', 'primaryContact' => array('firstName' => 'Pepe', 'lastName' => 'González', 'phone' => '934443344', 'email' => '*****@*****.**', 'mobile' => '655445533', 'fax' => '934443344'), 'billingAddress' => array('line1' => 'name line here', 'line2' => 'name line here', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'shippingAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080'), 'companyAddress' => array('line1' => 'line1', 'line2' => 'line2', 'city' => 'Barcelona', 'state' => 'Catalonia', 'country' => 'ES', 'postalCode' => '08080')));
     $this->_providerOrg->save();
     $customerData = '
     {
     "type": "customer",
     "name": "M2M_CUSTOMER_' . microtime(true) . '",
     "description": "Description",
     "status": 1,
     "defaultLanguage": "es",
     "billingCycleStart": {
     "dayOfMonth": 13,
     "timezone": "Europe/Madrid"
     },
     "currency": "978",
     "companyType": "1",
     "sector": "1",
     "companyAddress": {
     "line1": "cfsfsvsa",
     "line2": "Telefónica",
     "city": "Barcelona",
     "state": "Catalunya",
     "country": "ES",
     "postalCode": "5"
     },
     "primaryContact": {
     "firstName": "Alberto",
     "lastName": "Pastor",
     "phone": "931233372",
     "email": "*****@*****.**",
     "mobile": "653229800",
     "fax": "898989898"
     },
     "primaryContactAddressIsCompanyAddress": true,
     "primaryContactAddress": {
     "line1": "cfsfsvsa",
     "line2": "Telefónica",
     "city": "Barcelona",
     "state": "Catalunya",
     "country": "ES",
     "postalCode": "5"
     },
     "billingContactIsPrimaryContact": true,
     "billingContact": {
     "firstName": "Alberto",
     "lastName": "Pastor",
     "phone": "931233372",
     "email": "*****@*****.**",
     "mobile": "653229800",
     "fax": "898989898"
     },
     "billingContactAddressIsCompanyAddress": true,
     "billingContactAddress": {
     "line1": "cfsfsvsa",
     "line2": "Telefónica",
     "city": "Barcelona",
     "state": "Catalunya",
     "country": "ES",
     "postalCode": "5"
     },
     "shippingAddressIsCompanyAddress": true,
     "shippingAddress": {
     "line1": "cfsfsvsa",
     "line2": "Telefónica",
     "city": "Barcelona",
     "state": "Catalunya",
     "country": "ES",
     "postalCode": "76854"
     },
     "defaultBillingAccount": {
     "billingAccountName": "Default billing account",
     "billingAccountId": "",
     "fiscalNumber": "B244235457",
     "billable": true,
     "automaticPrebill": true,
     "crmBillingAccountId": "1",
     "addressIsCompanyAddress": true,
     "address": {
     "line1": "cfsfsvsa",
     "line2": "Telefónica",
     "city": "Barcelona",
     "state": "Catalunya",
     "country": "ES",
     "postalCode": "ES"
     },
     "contactIsPrimaryContact": true,
     "contact": {
     "firstName": "Alberto",
     "lastName": "Pastor",
     "phone": "931233372",
     "email": "*****@*****.**",
     "mobile": "653229800",
     "fax": "898989898"
     },
     "commercialGroups": [
     ""
     ],
     "numSubscriptions": 0,
     "taxes": {
     "tax": [
     {
     "name": "tax1",
     "value": 100
     },
     {
     "name": "tax2",
     "value": 200
     }
     ]
     },
     "discounts": {
     "discount": [
     {
     "name": "discount1",
     "steps": [
     {
     "threshold": 20,
     "value": 300
     },
     {
     "threshold": 20,
     "value": 300
     }
     ]
     },
     {
     "name": "discount2",
     "steps": [
     {
     "threshold": 60,
     "value": 300
     },
     {
     "threshold": 70,
     "value": 300
     }
     ]
     }
     ]
     },
     "paymentMethod": "visa",
     "paymentRelatedData": "1306101600"
     },
     "billingAccounts": {
     "billingAccount": [
     {
     "billingAccountName": "default",
     "billingAccountId": "",
     "fiscalNumber": "B244235457",
     "billable": true,
     "automaticPrebill": true,
     "crmBillingAccountId": "1",
     "addressIsCompanyAddress": true,
     "address": {
     "line1": "cfsfsvsa",
     "line2": "Telefónica",
     "city": "Barcelona",
     "state": "Catalunya",
     "country": "ES",
     "postalCode": "ES"
     },
     "contactIsPrimaryContact": false,
     "contact": {
     "firstName": "Alberto",
     "lastName": "Pastor",
     "phone": "931233372",
     "email": "*****@*****.**",
     "mobile": "653229800",
     "fax": "898989898"
     },
     "commercialGroups": [
     ""
     ],
     "numSubscriptions": 0,
     "taxes": {
     "tax": [
     {
     "name": "tax1",
     "value": 100
     },
     {
     "name": "tax2",
     "value": 200
     }
     ]
     },
     "discounts": {
     "discount": [
     {
     "name": "discount1",
     "steps": [
     {
     "threshold": 20,
     "value": 300
     },
     {
     "threshold": 20,
     "value": 300
     }
     ]
     },
     {
     "name": "discount2",
     "steps": [
     {
     "threshold": 60,
     "value": 300
     },
     {
     "threshold": 70,
     "value": 300
     }
     ]
     }
     ]
     },
     "paymentMethod": "visa",
     "paymentRelatedData": "1306101600"
     },
     {
     "billingAccountName": "default",
     "billingAccountId": "",
     "fiscalNumber": "B244235457",
     "billable": true,
     "automaticPrebill": true,
     "crmBillingAccountId": "1",
     "addressIsCompanyAddress": true,
     "address": {
     "line1": "cfsfsvsa",
     "line2": "Telefónica",
     "city": "Barcelona",
     "state": "Catalunya",
     "country": "ES",
     "postalCode": "ES"
     },
     "contactIsPrimaryContact": true,
     "contact": {
     "firstName": "Alberto",
     "lastName": "Pastor",
     "phone": "931233372",
     "email": "*****@*****.**",
     "mobile": "653229800",
     "fax": "898989898"
     },
     "commercialGroups": [
     ""
     ],
     "numSubscriptions": 0,
     "taxes": {
     "tax": [
     {
     "name": "tax1",
     "value": 100
     },
     {
     "name": "tax2",
     "value": 200
     }
     ]
     },
     "discounts": {
     "discount": [
     {
     "name": "discount1",
     "steps": [
     {
     "threshold": 20,
     "value": 300
     },
     {
     "threshold": 20,
     "value": 300
     }
     ]
     },
     {
     "name": "discount2",
     "steps": [
     {
     "threshold": 60,
     "value": 300
     },
     {
     "threshold": 70,
     "value": 300
     }
     ]
     }
     ]
     },
     "paymentMethod": "visa",
     "paymentRelatedData": "1306101600"
     }
     ]
     },
     "customFieldName_1": "custom_field_name_cust_1",
     "customFieldName_2": "custom_field_name_cust_2",
     "customFieldName_3": "custom_field_name_cust_3",
     "customFieldName_4": "custom_field_name_cust_4",
     "crmId_1": "crm1",
     "crmId_2": "crm2",
     "taxes": {
     "tax": [
     {
     "name": "tax1",
     "value": 100
     },
     {
     "name": "tax2",
     "value": 200
     }
     ]
     },
     "discounts": {
     "discount": [
     {
     "name": "discount1",
     "value": 300
     },
     {
     "name": "discount2",
     "value": 120
     }
     ]
     },
     "vpns": {
     "vpn": [
     {
     "name": "vpn1",
     "apns": [
     "2234",
     "9382"
     ],
     "staticAddressing": true,
     "network": "mask1",
     "mask": "network1"
     },
     {
     "name": "vpn2",
     "apns": [
     "3234",
     "2382"
     ],
     "staticAddressing": true,
     "network": "mask1",
     "mask": "network1"
     }
     ]
     },
     "parentId": "' . self::PROVIDER_COMMERCIAL_ORG_ID . '"
     }
     ';
     $array = Zend_Json::decode($customerData);
     $this->_customerOrg = new Model\Organization\OrgCustomerModel($array);
     $this->_customerOrg->parentId = $this->_providerOrg->getId();
     $this->_customerOrg->save();
     return $this->_customerOrg->getId();
 }