public function testFromArray()
 {
     $clientId = '123';
     $redirectUri = 'https://client/redirect';
     $method = 'secret';
     $params = array('password' => 'abc');
     $authenticationInfo = array('method' => $method, 'params' => $params);
     $properties = array('client_id' => $clientId, 'redirect_uri' => $redirectUri, 'authentication_info' => $authenticationInfo);
     $info = new ClientInfo();
     $info->fromArray($properties);
     $this->assertSame($clientId, $info->getClientId());
     $this->assertSame($redirectUri, $info->getRedirectUri());
     $authenticationInfo = $info->getAuthenticationInfo();
     $this->assertInstanceOf('InoOicClient\\Client\\AuthenticationInfo', $authenticationInfo);
     $this->assertSame($method, $authenticationInfo->getMethod());
     $this->assertSame($params, $authenticationInfo->getParams());
 }
 /**
  * {@inhertidoc}
  * @see \InoOicClient\Client\Authenticator\AuthenticatorFactoryInterface::createAuthenticator()
  */
 public function createAuthenticator(ClientInfo $clientInfo)
 {
     $authenticator = null;
     $authenticationInfo = $clientInfo->getAuthenticationInfo();
     if (!$authenticationInfo instanceof AuthenticationInfo) {
         throw new Exception\MissingAuthenticationInfoException('Client information does not contain any authentication info');
     }
     $authMethod = $authenticationInfo->getMethod();
     $authParams = $authenticationInfo->getParams();
     $clientId = $clientInfo->getClientId();
     switch ($authMethod) {
         case AuthenticationInfo::METHOD_SECRET_BASIC:
             $authenticator = $this->createSecretBasic($clientId, $authParams);
             break;
         case AuthenticationInfo::METHOD_SECRET_POST:
             $authenticator = $this->createSecretPost($clientId, $authParams);
             break;
         default:
             throw new Exception\UnsupportedAuthenticationMethodException(sprintf("Unsupported client authentication method '%s'", $authMethod));
     }
     return $authenticator;
 }