/**
  * @test
  */
 public function testSerializeShouldReturnXMLFull()
 {
     $items = new Items();
     $items->add(new Item(77, 'Produto 01', 2.5, 4, 20, 300));
     $items->add(new Item(88, 'Produto 02', 342.51, 3, 134.98, 1000));
     $shippingAddress = new Address('CE', 'Ortega do Norte', '40610-912', 'Ipe', 'R. Regina Salas', '3601', 'Bl.A');
     $shipping = new Shipping(1, $shippingAddress, 23.45);
     $order = new Order($items);
     $order->setReference('REF1234');
     $order->setExtraAmount(1.01);
     $order->setShipping($shipping);
     $customerAddress = new Address('AC', 'Sao Maite', '99500-079', 'Centro', 'Rua David Delgado', '55', 'Fundos');
     $customerPhone = new Phone('11', '99999999');
     $customer = new Customer('*****@*****.**', 'FooBar', $customerPhone, $customerAddress);
     $checkout = new Checkout($order);
     $checkout->setCustomer($customer);
     $checkout->setRedirectTo('http://localhost/return.php');
     $checkout->setMaxUses(5);
     $checkout->setMaxAge(60);
     $serializer = new CheckoutSerializer();
     $xml = $serializer->serialize($checkout);
     $this->assertInstanceOf(SimpleXMLElement::class, $xml);
     $expected = simplexml_load_file(__DIR__ . '/xml/checkoutFull.xml');
     $this->assertEquals($expected, $xml);
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function getMaxAgeShouldReturnConfiguredMaxAge()
 {
     $this->checkout->setMaxAge(12);
     $this->assertEquals(12, $this->checkout->getMaxAge());
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function setMaxAge($maxAge)
 {
     $this->checkout->setMaxAge($maxAge);
     return $this;
 }
Esempio n. 4
0
 /**
  * @test
  */
 public function setMaxAgeShouldConfigureTheMaximumAge()
 {
     $this->checkout->setMaxAge(1);
     $this->assertAttributeEquals(1, 'maxAge', $this->checkout);
 }