/**
  * @param array|string $response
  */
 public function setResponse($response)
 {
     parent::setResponse($response);
     if (count($this->response)) {
         $keys = array_keys($this->response);
         $this->setPaths(array_combine($keys, $keys));
     }
 }
 public function testGetMergeOfPathsIntoSingleField()
 {
     $paths = array('realname' => array('first_name', 'last_name'));
     $this->responseObject->setPaths($paths);
     $this->responseObject->setResponse(array('first_name' => 'foo', 'last_name' => 'bar'));
     $this->assertEquals('foo bar', $this->responseObject->getRealName());
     $this->responseObject->setResponse(array('first_name' => null, 'last_name' => 'bar'));
     $this->assertEquals('bar', $this->responseObject->getRealName());
 }
 /**
  * @expectedException \Symfony\Component\Security\Core\Exception\AuthenticationException
  */
 public function testNoIdentifierPath()
 {
     // easy path
     $paths = array('non_username' => 'non_existing');
     $this->responseObject->setPaths($paths);
     $this->responseObject->setResponse(json_encode(array('foo' => 'bar')));
     // should throw exception
     $this->responseObject->getNickname();
 }