/** * Test that validating a valid payload simply returns self. */ public function testValidateValidPayload() { // set up the payload to return something other than null for each // required field foreach ($this->requiredFields as $method) { $this->payload->expects($this->any())->method($method)->will($this->returnValue('not null')); } $validator = new OptionalGroup($this->requiredFields); $this->assertSame($validator, $validator->validate($this->payload)); }
/** * If given an IPayload, return the serialization of the payload. Otherwise, * return an empty string, no serialization. * * @param IPayload * @return string */ protected function serializeOptionalSubpayload(IPayload $payload = null) { return $payload ? $payload->serialize() : ''; }
/** * Get ship group order items data. * * @param IPayload * @param string * @return array */ public function getShipGroupItemsAsArray(IPayload $payload, $getter) { /** @var IOrderItemReferenceIterable $orderItems */ $orderItems = $payload->getItemReferences(); return $this->_getIterableValuesAsArray($orderItems, $getter); }
/** * Ensure the subpayload is a valid IPayload. * * @return self */ protected function validatePayload(IPayload $payload) { $payload->validate(); return $this; }