Ejemplo n.º 1
0
 /**
  * @test
  */
 public function getterShouldReturnConfiguredData()
 {
     $address = $this->getMock(Address::class, [], [], '', false);
     $shipping = new Shipping(Type::TYPE_PAC, $address, '10.31');
     $this->assertEquals(Type::TYPE_PAC, $shipping->getType());
     $this->assertSame($address, $shipping->getAddress());
     $this->assertEquals(10.31, $shipping->getCost());
 }
Ejemplo n.º 2
0
 /**
  * @param SimpleXMLElement $xml
  * @param Shipping $shipping
  */
 protected function appendShipping(SimpleXMLElement $xml, Shipping $shipping = null)
 {
     if ($shipping === null) {
         return;
     }
     $child = $xml->addChild('shipping');
     $child->addChild('type', $shipping->getType());
     $this->appendAddress($child, $shipping->getAddress());
     if ($cost = $shipping->getCost()) {
         $child->addChild('cost', $cost);
     }
 }