public function testListServiceProviderRegion()
 {
     // Provider with regions
     $regions = $this->_enumeratedMapper->listServiceProviderRegion(self::PROVIDER_COMMERCIAL_ORG_ID);
     $this->assertNotNull($regions);
     $this->assertEquals(3, count($regions));
     // Provider withour regions
     $regions = $this->_enumeratedMapper->listServiceProviderRegion(self::INEXISTENT_ORG_ID);
     $this->assertNotNull($regions);
     $this->assertEquals(0, count($regions));
 }
 /**
  * @group EricssonEnumeratedInt
  */
 public function testListMNO()
 {
     $mnos = $this->_enumeratedMapper->listMNO('sp1 (commercial)1111111111111112');
     $this->assertNotNull($mnos);
     $this->assertEquals(2, count($mnos));
     $this->assertEquals('ES', $mnos[0]['countryId']);
     $this->assertEquals('Vodafone', $mnos[0]['name']);
 }
 /**
  * Retrive the list of enum by type
  *
  * @param string $type
  */
 public function getEnum($type, $filters = array())
 {
     /**
      * @var \Application\Model\Mapper\EnumeratedMapper
      */
     $enumMapper = \Application\Model\Mapper\EnumeratedMapper::getInstance();
     if (!$type) {
         throw new Exceptions\InvalidArgumentException("Enum type is mandatory");
     }
     if ($filters && !is_array($filters)) {
         throw new Exceptions\InvalidArgumentException("filters is not an array");
     }
     switch ($type) {
         case self::COUNTRY_ENUM_NAME:
             return $enumMapper->listCountry();
         case self::CURRENCY_ENUM_NAME:
             return $enumMapper->listCurrency();
         case self::LANGUAGE_ENUM_NAME:
             return $enumMapper->listLanguage();
         case self::SECTOR_ENUM_NAME:
             return $enumMapper->listSector();
         case self::STATUS_ENUM_NAME:
             return $enumMapper->listStatus();
         case self::COMPANY_TYPE_ENUM_NAME:
             return $enumMapper->listCompanyType();
         case self::TIME_ZONE_STATIC_ENUM_NAME:
             return $enumMapper->listStaticTimeZone();
         case self::MNO_ENUM_NAME:
             return $enumMapper->listMNO();
         default:
             // Get service provider id
             if (isset($filters['serviceProvider'])) {
                 $orgId = $filters['serviceProvider'];
             } else {
                 $org = \App::getOrgUserLogged();
                 $orgId = OrgService::getInstance()->getServiceProviderLevelId($org);
             }
             // Get enum by service provider
             switch ($type) {
                 case self::RAID_ENUM_NAME:
                     return $enumMapper->listRaid($orgId);
                 case self::SERVICE_PROVIDER_ZONE_ENUM_NAME:
                     $zones = $enumMapper->listServiceProviderZone($orgId);
                     return $this->_filterDefaultValues($zones);
                 case self::SERVICE_PROVIDER_DESTINATION_ENUM_NAME:
                     $destinations = $enumMapper->listServiceProviderDestination($orgId);
                     return $this->_filterDefaultValues($destinations);
                 case self::TIME_ZONE_ENUM_NAME:
                     return $enumMapper->listTimeZone($orgId);
                 case self::SERVICE_PROVIDER_REGION_ENUM_NAME:
                     $regions = $enumMapper->listServiceProviderRegion($orgId);
                     return $this->_filterDefaultValues($regions);
                 default:
                     throw new AppEx\InvalidArgumentException("Enumerated " . $type . " doesn't exist");
             }
     }
 }