/**
  * @group EricssonCommercialGroupInt
  */
 public function testFindAll()
 {
     $this->commercialGroupMapper->insert($this->commercialGroup);
     $this->assertNotNull($this->commercialGroup->getId());
     $commercialGroups = $this->commercialGroupMapper->findAll();
     $this->assertNotNull($commercialGroups);
     $this->assertGreaterThanOrEqual(1, $commercialGroups->getCount());
     $items = $commercialGroups->getItems();
     foreach ($items as $item) {
         $this->assertInstanceOf('\\Application\\Model\\CommercialGroupModel', $item);
     }
 }
 public function testUpdateAuthorizedAndRestrictedNumbers()
 {
     $this->commercialGroupMapper->insert($this->commercialGroup);
     $this->assertNotNull($this->commercialGroup->getId());
     $commGroup = $this->commercialGroupMapper->findOneById($this->commercialGroup->getId());
     $whiteList = $commGroup->getWhiteList();
     $whiteList[] = "984847766";
     $commGroup->setWhiteList($whiteList);
     $blackList = $commGroup->getBlackList();
     $blackList[] = "888474632";
     $commGroup->setBlackList($whiteList);
     $result = $this->commercialGroupMapper->update($commGroup);
     $this->assertNotNull($result);
     $this->assertEquals($this->commercialGroup->getId(), $result);
 }
 public function unassignAggregator(CommercialGroupModel $cg)
 {
     if (!$cg) {
         throw new AppEx\InvalidArgumentException('Params cannot be null');
     }
     $cg->setAggregatorId("");
     $cg->setAggregatorName(null);
     $result = $this->update($cg);
     return $result;
 }
 /**
  * @param  \Application\Model\CommercialGroupModel $model
  * @return mixed
  * @throws EricssonException
  */
 public function updateScreening(CommercialGroupModel $model)
 {
     $this->getCache()->remove($model->getId());
     $methodName = self::METHOD_NAME_UPDATE_SCREENING;
     /**
      * @var $proto \Application\Proto\CommercialGroup\UpdateScreeningData
      */
     $proto = $this->_createProto($methodName);
     $proto->setId($model->getId());
     $data = $this->_mapModelToEricssonModel($model->exportData());
     if (isset($data['white_list'])) {
         $whiteList = new \Application\Proto\ScreeningList();
         $whiteList->parse($data['white_list'], new \DrSlump\Protobuf\Codec\PhpArray());
         $proto->setWhiteList($whiteList);
     }
     if (isset($data['black_list'])) {
         $blackList = new \Application\Proto\ScreeningList();
         $blackList->parse($data['black_list'], new \DrSlump\Protobuf\Codec\PhpArray());
         $proto->setBlackList($blackList);
     }
     if (isset($data['roaming_list'])) {
         $roamingList = new \Application\Proto\ScreeningList();
         $roamingList->parse($data['roaming_list'], new \DrSlump\Protobuf\Codec\PhpArray());
         $proto->setRoamingList($roamingList);
     }
     $watcher = $this->_constructWatcherToTransaction();
     $watcher->params->action = 'commercialGroupUpdateScreeningList';
     $watcher->params->commercialGroupId = $model->id;
     $watcher->params->count = $model->subscriberCount;
     return $this->_sendAsyncRequest($methodName, $proto, array(), array(), $watcher);
 }