/**
  * Generate an Intacct session based on login credentials
  *
  * @param LoginCredentials $loginCreds
  * @return SessionCredentials
  */
 public function fromLoginCredentials(LoginCredentials $loginCreds)
 {
     $senderCreds = $loginCreds->getSenderCredentials();
     $endpoint = $loginCreds->getEndpoint();
     $config = $this->getConfig($senderCreds, $endpoint);
     $config['company_id'] = $loginCreds->getCompanyId();
     $config['user_id'] = $loginCreds->getUserId();
     $config['user_password'] = $loginCreds->getPassword();
     $config['mock_handler'] = $loginCreds->getMockHandler();
     $session = $this->getAPISession($config);
     return new SessionCredentials($session, $senderCreds);
 }
 /**
  * @covers Intacct\Credentials\LoginCredentials::__construct
  * @covers Intacct\Credentials\LoginCredentials::getMockHandler
  */
 public function testGetMockHandler()
 {
     $response = new Response(200);
     $mock = new MockHandler([$response]);
     $config = ['company_id' => 'testcompany', 'user_id' => 'testuser', 'user_password' => 'testpass', 'mock_handler' => $mock];
     $loginCreds = new LoginCredentials($config, $this->senderCreds);
     $this->assertThat($loginCreds->getMockHandler(), $this->isInstanceOf('GuzzleHttp\\Handler\\MockHandler'));
 }