コード例 #1
0
 public function setUp()
 {
     $logContext = $this->getHelperMock('ebayenterprise_magelog/context', ['getMetaData']);
     $logContext->expects($this->any())->method('getMetaData')->will($this->returnValue([]));
     $this->_api = $this->getMockForAbstractClass('eBayEnterprise\\RetailOrderManagement\\Api\\IBidirectionalApi');
     // Create two request bodies - one to serve as the "empty" request
     // body that needs to be populated with data and one to serve as
     // the "complete" payload that has been populated with data.
     $this->_emptyRequestBody = $this->getMockForAbstractClass('eBayEnterprise\\RetailOrderManagement\\Payload\\TaxDutyFee\\ITaxDutyFeeQuoteRequest');
     $this->_completeRequestBody = $this->getMockForAbstractClass('eBayEnterprise\\RetailOrderManagement\\Payload\\TaxDutyFee\\ITaxDutyFeeQuoteRequest');
     $this->_responseBody = $this->getMockForAbstractClass('eBayEnterprise\\RetailOrderManagement\\Payload\\TaxDutyFee\\ITaxDutyFeeQuoteReply');
     $this->_coreHelper = $this->getHelperMock('ebayenterprise_eb2ccore', ['getSdkApi']);
     $this->_taxConfig = $this->buildCoreConfigRegistry(['apiService' => $this->_apiService, 'apiOperation' => $this->_apiOperation]);
     $this->_taxHelper = $this->getHelperMock('ebayenterprise_tax/data', ['__']);
     $this->_taxHelper->expects($this->any())->method('__')->will($this->returnArgument(0));
     $this->_taxFactory = $this->getHelperMock('ebayenterprise_tax/factory', ['createRequestBuilderQuote', 'createResponseQuoteParser', 'createTaxResults']);
     $this->_quoteRequestBuilder = $this->getModelMockBuilder('ebayenterprise_tax/request_builder_quote')->disableOriginalConstructor()->setMethods(['getTaxRequest'])->getMock();
     $this->_quoteResponseParser = $this->getModelMockBuilder('ebayenterprise_tax/response_parser_quote')->disableOriginalConstructor()->setMethods(['getTaxRecords', 'getTaxDuties', 'getTaxFees'])->getMock();
     $this->_quote = $this->getModelMock('sales/quote');
     $this->_taxHelper = $this->getHelperMock('ebayenterprise_tax', ['getConfigModel']);
     $this->_taxHelper->method('getConfigModel')->willReturn($this->_taxConfig);
     // As helpers do not support constructor injection, inject
     // dependencies by directly setting the class properties.
     EcomDev_Utils_Reflection::setRestrictedPropertyValues($this->_taxHelper, ['coreHelper' => $this->_coreHelper, 'taxFactory' => $this->_taxFactory, 'logContext' => $logContext]);
 }
コード例 #2
0
 /**
  * When the quote is invalid for making a tax request, no request should
  * be attempted and existing tax records should be cleared - reset
  * to empty arrays.
  *
  * By default, the quote used in the tests will be considered to be invalid
  * for tax requests - no item count as well as missing address data.
  */
 public function testCollectTaxesFailedInvalidQuote()
 {
     // Simulate the TDK request returning a set of tax records.
     $this->_taxHelper->expects($this->never())->method('requestTaxesForQuote');
     // Side-effect test - ensure all tax records in the session storage are
     // emptied of existing tax records when a tax request fails to be made.
     $this->_taxSession->expects($this->once())->method('setTaxRecords')->with($this->identicalTo([]))->will($this->returnSelf());
     $this->_taxSession->expects($this->once())->method('setTaxDuties')->with($this->identicalTo([]))->will($this->returnSelf());
     $this->_taxSession->expects($this->once())->method('setTaxFees')->with($this->identicalTo([]))->will($this->returnSelf());
     // Side-effect test - ensure that when a tax request was made successfully,
     // that a flag indicating that is set in the session.
     $this->_taxSession->expects($this->once())->method('setTaxRequestSuccess')->with($this->identicalTo(false))->will($this->returnSelf());
     $this->setExpectedException('EbayEnterprise_Tax_Exception_Collector_InvalidQuote_Exception');
     $this->_taxCollector->collectTaxes($this->_quote);
 }