public function testOnRealExample() { $shippingMethod = $this->singleShippingMethodTransformer->transform(new UsersShippingModel()); $this->assertInstanceOf('Team3\\PayU\\Order\\Model\\ShippingMethods\\ShippingMethodInterface', $shippingMethod); $this->assertNotEmpty($shippingMethod->getCountry()); $this->assertNotEmpty($shippingMethod->getName()); $this->assertNotEmpty($shippingMethod->getPrice()); }
/** * @inheritdoc */ public function transform(OrderInterface $order, ExtractorResult $extractorResult) { /** @var \Traversable $shippingMethodCollection */ $shippingMethodCollection = $extractorResult->getValue(); $this->checkCollection($shippingMethodCollection); foreach ($shippingMethodCollection as $usersShippingMethod) { $order->getShippingMethodCollection()->addShippingMethod($this->singleShippingMethodTransformer->transform($usersShippingMethod)); } }
public function it_should_call_helper(SingleShippingMethodTransformer $singleShippingMethodTransformer, ExtractorResult $extractorResult, OrderInterface $order, \stdClass $usersShippingMethod) { $extractorResult->getValue()->willReturn([$usersShippingMethod]); $extractorResult->getValue()->shouldBeCalledTimes(1); $order->getShippingMethodCollection()->willReturn(new ShippingMethodCollection()); $order->getShippingMethodCollection()->shouldBeCalledTimes(1); $singleShippingMethodTransformer->transform($usersShippingMethod)->willReturn(new ShippingMethod()); $singleShippingMethodTransformer->transform($usersShippingMethod)->shouldBeCalledTimes(1); $this->transform($order, $extractorResult); }