/** * Generate an Intacct session based on existing session credentials * * @param SessionCredentials $sessionCreds * @return SessionCredentials */ public function fromSessionCredentials(SessionCredentials $sessionCreds) { $senderCreds = $sessionCreds->getSenderCredentials(); $endpoint = $sessionCreds->getEndpoint(); $config = $this->getConfig($senderCreds, $endpoint); $config['session_id'] = $sessionCreds->getSessionId(); $config['mock_handler'] = $sessionCreds->getMockHandler(); $session = $this->getAPISession($config); return new SessionCredentials($session, $senderCreds); }
/** * @covers Intacct\Credentials\SessionCredentials::__construct * @covers Intacct\Credentials\SessionCredentials::getMockHandler */ public function testGetMockHandler() { $response = new Response(200); $mock = new MockHandler([$response]); $config = ['session_id' => 'faKEsesSiOnId..', 'endpoint_url' => 'https://p1.intacct.com/ia/xml/xmlgw.phtml', 'mock_handler' => $mock]; $sessionCreds = new SessionCredentials($config, $this->senderCreds); $this->assertThat($sessionCreds->getMockHandler(), $this->isInstanceOf('GuzzleHttp\\Handler\\MockHandler')); }