/** * @covers Intacct\Credentials\LoginCredentials::__construct * @covers Intacct\Credentials\LoginCredentials::getCompanyId * @covers Intacct\Credentials\LoginCredentials::getUserId * @covers Intacct\Credentials\LoginCredentials::getPassword * @covers Intacct\Credentials\LoginCredentials::getSenderCredentials * @covers Intacct\Credentials\LoginCredentials::getEndpoint */ public function testCredsFromArray() { $config = ['company_id' => 'testcompany', 'user_id' => 'testuser', 'user_password' => 'testpass']; $loginCreds = new LoginCredentials($config, $this->senderCreds); $this->assertEquals('testcompany', $loginCreds->getCompanyId()); $this->assertEquals('testuser', $loginCreds->getUserId()); $this->assertEquals('testpass', $loginCreds->getPassword()); $endpoint = $loginCreds->getEndpoint(); $this->assertEquals('https://api.intacct.com/ia/xml/xmlgw.phtml', $endpoint); $this->assertThat($loginCreds->getSenderCredentials(), $this->isInstanceOf('Intacct\\Credentials\\SenderCredentials')); }
/** * 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); }