/**
  * When extracting results from the SDK response, a tax
  * result model with the tax data extracted from the
  * response should be returned.
  */
 public function testExtractResponseResultsSuccess()
 {
     // Create an expected result, should be returned when successfully
     // extracting results from a response.
     $sdkResult = $this->getModelMockBuilder('ebayenterprise_tax/result')->disableOriginalConstructor()->getMock();
     // Mock the API to return an expected response body as the
     // reply to the SDK request.
     $this->_api->expects($this->any())->method('getResponseBody')->will($this->returnValue($this->_responseBody));
     // Mock up some SDK results - doesn't really matter what these
     // are, just that they can be recognized as the "right" results.
     $taxRecords = [$this->getModelMockBuilder('ebayenteprirse_tax/record')->disableOriginalConstructor()->getMock()];
     $taxDuties = [$this->getModelMockBuilder('ebayenteprirse_tax/duty')->disableOriginalConstructor()->getMock()];
     $taxFees = [$this->getModelMockBuilder('ebayenteprirse_tax/fee')->disableOriginalConstructor()->getMock()];
     // Create a quote response parser capable of returning the
     // proper results from the tax response.
     $this->_quoteResponseParser->expects($this->any())->method('getTaxRecords')->will($this->returnValue($taxRecords));
     $this->_quoteResponseParser->expects($this->any())->method('getTaxDuties')->will($this->returnValue($taxDuties));
     $this->_quoteResponseParser->expects($this->any())->method('getTaxFees')->will($this->returnValue($taxFees));
     // Setup the tax factory to be able to provide the proper quote
     // response parser if given the correct response payload and quote.
     $this->_taxFactory->expects($this->any())->method('createResponseQuoteParser')->with($this->identicalTo($this->_responseBody), $this->identicalTo($this->_quote))->will($this->returnValue($this->_quoteResponseParser));
     // Setup the tax factory to be able to provide the proper SDK result
     // if given the expected tax data.
     $this->_taxFactory->expects($this->any())->method('createTaxResults')->with($this->identicalTo($taxRecords), $this->identicalTo($taxDuties), $this->identicalTo($taxFees))->will($this->returnValue($sdkResult));
     // Ensure that the correct SDK result is returned when extracting
     // results from the SDK. For now, this will return the exact same
     // instance as is expected. In the future this may not be the case and
     // test could be expected to simply ensure the results available in
     // the returned result model match the expected results.
     $this->assertSame($sdkResult, EcomDev_Utils_Reflection::invokeRestrictedMethod($this->_sdkHelper, '_extractResponseResults', [$this->_api, $this->_quote]));
 }
 /**
  * Getting tax records for a quote should extract all tax records for all
  * addresses belonging to that quote.
  */
 public function testBuildingTaxRecordsForQuote()
 {
     // Set the tax factory to expect to get the expected ship group and
     // address and return the address parser that will give the expected
     // address tax records.
     $this->_taxFactory->expects($this->once())->method('createResponseAddressParser')->with($this->identicalTo($this->_shipGroup, $this->_address))->will($this->returnValue($this->_addressParser));
     // In this case there is one ship group, related to one address so the
     // tax records returned, should be the tax records for that address.
     $this->assertSame($this->_addressTaxRecords, $this->_quoteParser->getTaxRecords());
     $this->assertSame($this->_addressTaxDuties, $this->_quoteParser->getTaxDuties());
     $this->assertSame($this->_addressTaxFees, $this->_quoteParser->getTaxFees());
 }