public function setUp() { // placeholder object, just so the factory will have something to return $this->payload = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\IPayload'); // this will be stubbed to return expected message type config keys $this->config = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Api\\IConfig'); // stub the payload factory to always just return a payload $this->payloadFactory = $this->getMock('\\eBayEnterprise\\RetailOrderManagement\\Payload\\IPayloadFactory'); $this->payloadFactory->expects($this->any())->method('buildPayload')->will($this->returnValue($this->payload)); $this->messageTypes = [self::SUPPORTED_MESSAGE_TYPE => ['request' => '\\eBayEnterprise\\RetailOrderManagement\\Payload\\IPayload', 'reply' => '\\eBayEnterprise\\RetailOrderManagement\\Payload\\IPayload']]; $this->messageFactory = new BidirectionalMessageFactory($this->config, $this->payloadFactory, $this->messageTypes); }
/** * Generate a filled in physical address payload object. * * @param int number of street lines to include * @return IPhysicalAddress */ protected function _generatePayloadObject($empty = false, $streetLines = 4) { $payload = $this->_sdkPayloadFactory->buildPayload('\\eBayEnterprise\\RetailOrderManagement\\Payload\\Address\\SuggestedAddress'); if ($empty) { return $payload; } $street = array(); for ($i = 1; $i <= $streetLines; $i++) { $street[] = $this->_addressParts['line' . $i]; } return $payload->setLines(implode("\n", $street))->setCity($this->_addressParts['city'])->setMainDivision($this->_addressParts['region_code'])->setCountryCode($this->_addressParts['country_id'])->setPostalCode($this->_addressParts['postcode']); }