コード例 #1
0
ファイル: Operation.php プロジェクト: Intacct/intacct-sdk-php
 /**
  * Initializes the class
  *
  * @param SimpleXMLIterator $operation
  */
 public function __construct(SimpleXMLIterator $operation)
 {
     if (!isset($operation->authentication)) {
         throw new IntacctException('Authentication block is missing from operation element');
     }
     $this->setAuthentication($operation->authentication);
     if ($this->authentication->getStatus() !== 'success') {
         $errors = [];
         if (isset($operation->errormessage)) {
             $errorMessage = new ErrorMessage($operation->errormessage);
             $errors = $errorMessage->getErrors();
         }
         throw new OperationException('Response authentication status failure', $errors);
     }
     if (!isset($operation->result[0])) {
         throw new IntacctException('Result block is missing from operation element');
     }
     foreach ($operation->result as $result) {
         $this->setResult($result);
     }
 }
コード例 #2
0
 /**
  * @covers Intacct\Xml\Response\Operation\Authentication::getStatus
  */
 public function testGetStatus()
 {
     $this->assertEquals('success', $this->object->getStatus());
 }