public function testSerializeShouldXMLFull() { $items = new Items(); $items->add(new Item(99, 'Produto 03', 1.77, 8, 12.9, 360)); $items->add(new Item(97, 'Produto 04', 43.67, 3, 134.98, 1100)); $charge = new Charge($items); $charge->setSubscriptionCode(4556788); $charge->setReference('abcdef'); $serializer = new ChargeSerializer(); $xml = $serializer->serialize($charge); $this->assertInstanceOf(SimpleXMLElement::class, $xml); $expected = simplexml_load_file(__DIR__ . '/xml/chargeFull.xml'); $this->assertEquals($expected, $xml); }
/** * {@inheritdoc} */ public function charge(Charge $charge) { $response = $this->post(static::CHARGE_ENDPOINT, $this->serializer->serialize($charge)); return new ChargeResponse((string) $response->transactionCode, new DateTime((string) $response->date)); }