/**
  * @return void
  */
 public function testGetAggregatedErrorMessage()
 {
     $exception = new OauthInputException();
     foreach (['field1', 'field2'] as $param) {
         $exception->addError(new Phrase('%fieldName is a required field.', ['fieldName' => $param]));
     }
     $exception->addError(new Phrase('Message with period.'));
     $this->assertEquals('field1 is a required field, field2 is a required field, Message with period', $exception->getAggregatedErrorMessage());
 }
Exemplo n.º 2
0
 /**
  * Check if mandatory OAuth parameters are present.
  *
  * @param array $protocolParams
  * @param array $requiredParams
  * @return void
  * @throws OauthInputException
  */
 protected function _checkRequiredParams($protocolParams, $requiredParams)
 {
     $exception = new OauthInputException();
     foreach ($requiredParams as $param) {
         if (!isset($protocolParams[$param])) {
             $exception->addError(new Phrase(OauthInputException::REQUIRED_FIELD, ['fieldName' => $param]));
         }
     }
     if ($exception->wasErrorAdded()) {
         throw $exception;
     }
 }