public function testFindAllByProviderSortingRaise202Exception()
 {
     $filters = array('organizationId' => self::PROVIDER_ENABLER_ORG_ID);
     $filterList = new App_ListFilter();
     $filterList->setSortingField(SimSortingFields::MSISDN);
     $filterList->setSortType(App_ListFilter::SORT_TYPE_ASC);
     $filters['filterList'] = $filterList;
     try {
         $sims = $this->simMapper->findAll($filters);
         $sims->getCount();
         $this->assertTrue(false, "Must raise exception");
     } catch (Exception $ex) {
         $this->assertInstanceOf('\\Application\\Model\\Mapper\\Exception\\EricssonException', $ex);
         $this->assertEquals(202, $ex->getCode());
     }
 }
 /**
  * @group EricssonGroupingInt
  */
 public function testSortByICCAsc()
 {
     $rawFilters = array('sortBy' => \Application\Model\Sorting\SimSortingFields::ICC);
     $filterList = SimService::getInstance()->buildFilterList($rawFilters);
     $filters = array('organizationId' => Application\Model\Organization\OrgServiceProviderModel::ORG_TYPE . '-' . 'sp1 (non-commercial)111111111111', 'filterList' => $filterList);
     $sims = $this->simMapper->findAll($filters, array('count' => 100));
     $this->assertNotNull($sims);
     $this->assertInstanceOf('\\Application\\Model\\ListResultModel', $sims);
     $beforeId = NULL;
     foreach ($sims->getItems() as $sim) {
         $currentId = $sim->getId();
         if ($beforeId) {
             $this->assertTrue($currentId > $beforeId, "Current: {$currentId}. Before: {$beforeId}");
         }
         $beforeId = $sim->getId();
     }
 }
 /**
  * @group EricssonInt
  */
 public function testFindAllByMaster()
 {
     $this->markTestSkipped("Not implemented by Ericsson");
     $filters = array('organizationId' => Application\Model\Organization\OrgMasterModel::ORG_TYPE . '-' . 'MASTER:0000000000000000000000001');
     $sims = $this->simMapper->findAll($filters);
     $this->assertNotNull($sims);
     $this->assertEquals('100', count($sims));
     echo 'simsCount: ' . count($sims);
 }
 /**
  * @group EricssonGroupingInt
  */
 public function testGroupLocalWithFilterAndHighlight()
 {
     $rawFilters = array('customer' => Application\Model\Organization\OrgCustomerModel::ORG_TYPE . '-' . 'the_fist_customer000000000000000', 'groupBy' => Application\Model\Group\SimGroups::SIM_TYPE, 'group' => 'LOCAL', 'highlighting' => Application\Model\Group\SimGroups::LIFE_CYCLE_STATE);
     $filterList = SimService::getInstance()->buildFilterList($rawFilters);
     $filters = array('organizationId' => Application\Model\Organization\OrgMasterModel::ORG_TYPE . '-' . 'master11111111111111111111111111', 'filterList' => $filterList);
     $sims = $this->simMapper->findAll($filters, array('count' => 100));
     $this->assertNotNull($sims);
     $this->assertInstanceOf('Application\\Model\\GroupListModel', $sims);
     $results = array('TEST' => 0, 'RETIRED' => 0, 'SUSPENDED' => 0, 'INACTIVE_NEW' => 251, 'ACTIVATION_READY' => 0, 'ACTIVE' => 0, 'DEACTIVATED' => 0, 'ACTIVATION_PENDANT' => 0);
     foreach ($results as $state => $count) {
         $simState = $sims->getGroupByLabel($state);
         $this->assertNotNull($simState, $state . " not defined.");
         $this->assertGreaterThanOrEqual($count, $simState->getCount(), $state . " must have " . $count . " items.");
     }
     //         $simLocal = $sims->getGroupByLabel('L');
     //         $this->assertNotNull($simLocal);
     //         $this->assertEquals('251', $simLocal->getCount());
 }
 /**
  * @group EricssonListPagingInt
  */
 public function testFindAllByMasterFilterPaging()
 {
     $rawFilters = array('simType' => SimModel::SIM_TYPE_LOCAL);
     $filterList = SimService::getInstance()->buildFilterList($rawFilters);
     $filters = array('organizationId' => Application\Model\Organization\OrgMasterModel::ORG_TYPE . '-' . 'master11111111111111111111111111', 'filterList' => $filterList);
     $options = array('page' => 1, 'count' => 50);
     $sims = $this->simMapper->findAll($filters, $options);
     echo "\nCount:" . $sims->getCount() . "\n";
     $this->assertNotNull($sims);
     $this->assertEquals('50', count($sims->getItems()), "Page: " . $options['page']);
     $options = array('page' => 2, 'count' => 50);
     $sims = $this->simMapper->findAll($filters, $options);
     $this->assertNotNull($sims);
     $this->assertEquals('50', count($sims->getItems()), "Page: " . $options['page']);
     $options = array('page' => 6, 'count' => 50);
     $sims = $this->simMapper->findAll($filters, $options);
     $this->assertNotNull($sims);
     $this->assertEquals('50', count($sims->getItems()), "Page: " . $options['page']);
     $options = array('page' => 8, 'count' => 50);
     $sims = $this->simMapper->findAll($filters, $options);
     $this->assertNotNull($sims);
     $this->assertGreaterThanOrEqual('26', count($sims->getItems()), "Page: " . $options['page']);
 }