public function testInvalidServicePackType()
 {
     $servicePack = new ServicePackModel($this->_data);
     $result = $this->_validator->isValid($servicePack->getId());
     $this->assertFalse($result);
     $messages = $this->_validator->getMessages();
     $this->assertArrayHasKey(App_Validate_Ericsson_ServicePackExistsById::ERROR_INVALID_TYPE, $messages);
 }
 protected function _updateEricsson(ServicePackModel $model)
 {
     $methodName = self::METHOD_NAME_UPDATE;
     $proto = $this->_createProto($methodName);
     $data = $this->_mapModelToEricssonModel($model->exportData());
     $updateData = new PB\ServicePack\ServicePackUpdate();
     $updateData->parse($data, new \DrSlump\Protobuf\Codec\PhpArray());
     $proto->setUpdateData($updateData);
     $proto->setId($model->getId());
     $response = $this->_sendRequest($methodName, array('protoMessage' => $proto));
     return $this->_checkPutResponse($response);
 }
 /**
  * @param  Application\Model\ServicePackModel $service
  * @return boolean
  */
 public function removeCustomer(ServicePackModel $service, OrgModelAbstract $org)
 {
     if (!strlen((string) $service->getId())) {
         throw new AppEx\InvalidArgumentException("Service pack does not have an Id");
     }
     if (!$org instanceof OrgCustomerModel) {
         throw new AppEx\InvalidArgumentException("Organization must be a customer.");
     }
     $orgId = $org->getId();
     if (!isset($orgId) && !strlen($orgId)) {
         throw new AppEx\InvalidArgumentException("Organization customer does not have an Id");
     }
     if ($service->commercialGroup) {
         $errors[] = "\t- " . \Zend_Json::encode('Service Pack already has commercial groups assigned ');
         $errors = implode("\n", $errors);
         throw new AppEx\ValidateException("The supplServices model does not pass the validation rules:\n" . $errors);
     }
     $result = $this->getMapper()->removeCustomer($service->getId(), $org->getId());
     \App::audit('Removed customer ' . $org->getId() . ' from service pack with Id ' . $service->getId(), $service);
     return $result;
 }