/** * @covers Intacct\Credentials\SessionCredentials::__construct * @covers Intacct\Credentials\SessionCredentials::getSessionId * @covers Intacct\Credentials\SessionCredentials::getEndpoint * @covers Intacct\Credentials\SessionCredentials::getSenderCredentials */ public function testCredsFromArray() { $config = ['session_id' => 'faKEsesSiOnId..', 'endpoint_url' => 'https://p1.intacct.com/ia/xml/xmlgw.phtml']; $sessionCreds = new SessionCredentials($config, $this->senderCreds); $this->assertEquals('faKEsesSiOnId..', $sessionCreds->getSessionId()); $endpoint = $sessionCreds->getEndpoint(); $this->assertEquals('https://p1.intacct.com/ia/xml/xmlgw.phtml', $endpoint->getEndpoint()); $this->assertThat($sessionCreds->getSenderCredentials(), $this->isInstanceOf('Intacct\\Credentials\\SenderCredentials')); }
/** * 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); }