public function tearDown()
 {
     // If the org was persisted delete it
     if ($id = $this->_model->getId()) {
         // Check if it actually exists
         try {
             if ($this->_mapper->findOneById($id)) {
                 try {
                     $this->_mapper->delete($id);
                 } catch (Exception $e) {
                     fputs(STDOUT, "WARNING: Deleting organization error\n");
                 }
             }
         } catch (Exception $e) {
             fputs(STDOUT, "WARNING: Finding by ID organization error\n");
         }
     }
     // If the org was persisted delete it
     if ($id = $this->_parentModel->getId()) {
         // Check if it actually exists
         $mapper = OrgMasterMapper::getInstance();
         if ($mapper->findOneById($id)) {
             try {
                 $mapper->delete($id);
             } catch (Exception $e) {
             }
         }
     }
     if ($this->_user && $this->_user->getId()) {
         $this->_user->delete();
     }
 }
 public function testValidateOrgMasterNotExists()
 {
     $org = OrgModelFactory::factory($this->_masterData);
     OrgMasterMapper::getInstance()->insert($org);
     $this->_orgIdToDelete = $org->getId();
     $result = $this->_validator->isValid($org->getId());
     $this->assertTrue($result);
 }
 public function setUp()
 {
     $this->_org = new OrgMasterModel(array('name' => 'ORG_TEST' . microtime(true), 'description' => 'Description', 'status' => \Application\Model\OrgModelAbstract::ORG_STATUS_ACTIVATED, 'type' => OrgMasterModel::ORG_TYPE, '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', 'country' => "ES", 'postalCode' => '08005'), 'customFieldName1' => 'a', 'customFieldName2' => 'b', 'customFieldName3' => 'c', 'customFieldName4' => 'd'));
     //Delete org if exist by name
     $org = OrgMasterMapper::getInstance()->findOneByName($this->_org->getName());
     if ($org) {
         $org->delete();
     }
     $this->_org->save();
     $this->_user = new UserModel(array('userName' => 'userservicetest', 'password' => 'testing1234', 'email' => '*****@*****.**', 'firstName' => 'Tester', 'lastName' => 'Testal', 'phone' => '+34654654654', 'organizationId' => $this->_org->getId(), 'country' => "ES", 'language' => "es", 'timezone' => 'Europe/Madrid', 'role' => 'user', 'status' => 'pending', 'domains' => array('Domain Test 1', 'Domain Test 2'), 'monetaryDataAccess' => true));
     $this->_service = UserService::getInstance();
     self::initAuthUser(self::PROVIDER_COMMERCIAL_USER_ID);
 }
 public function setUp()
 {
     $this->_org = new OrgMasterModel(array('name' => 'ORG_TEST' . microtime(true), 'description' => "Description", 'status' => OrgMasterModel::ORG_STATUS_ACTIVATED, 'type' => OrgMasterModel::ORG_TYPE, '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->_mapper = OrgMasterMapper::getInstance();
 }
 public function tearDown()
 {
     if (!is_null($this->_orgIdToDelete)) {
         OrgMasterMapper::getInstance()->delete($this->_orgIdToDelete);
     }
 }
 protected function _mapSubscriptionBaseTarget($data)
 {
     switch ($data['type']) {
         case Target\SubscriptionBaseTarget\OrgType::MASTER:
             $mapper = \Application\Model\Mapper\Organization\OrgMasterMapper::getInstance();
             break;
         case Target\SubscriptionBaseTarget\OrgType::SERVICE_PROVIDER:
             $mapper = \Application\Model\Mapper\Organization\OrgServiceProviderMapper::getInstance();
             break;
         case Target\SubscriptionBaseTarget\OrgType::CUSTOMER:
             $mapper = \Application\Model\Mapper\Organization\OrgCustomerMapper::getInstance();
             break;
         default:
             return array();
     }
     return array('organization' => $mapper::buildOrgId($data['id']));
 }