/** * Get API session array * * @param array $config * @return array */ private function getAPISession(array $config) { $contentBlock = new Content(); $getApiSession = new ApiSessionCreate(); $contentBlock->append($getApiSession); $requestHandler = new RequestHandler($config); $response = $requestHandler->executeSynchronous($config, $contentBlock); $operation = $response->getOperation(); $authentication = $operation->getAuthentication(); $result = $operation->getResult(0); $data = $result->getData(); $api = $data->api; $session = ['session_id' => strval($api->sessionid), 'endpoint_url' => strval($api->endpoint), 'verify_ssl' => $requestHandler->getVerifySSL(), 'current_company_id' => $authentication->getCompanyId(), 'current_user_id' => $authentication->getUserId(), 'current_user_is_external' => $authentication->getSlideInUser()]; return $session; }
/** * @covers Intacct\Content::__construct */ public function testContent() { $contentBlock = new Content(); $func = new ApiSessionCreate(); $contentBlock->append($func); }
/** * @covers Intacct\Xml\Request\OperationBlock::__construct * @expectedException InvalidArgumentException * @expectedExceptionMessage Required "company_id", "user_id", and "user_password" keys, or "session_id" key, not supplied in params */ public function testNoCredentials() { $config = ['session_id' => null, 'company_id' => null, 'user_id' => null, 'user_password' => null]; $contentBlock = new Content(); $func = new ApiSessionCreate(); $contentBlock->append($func); new OperationBlock($config, $contentBlock); }