public function testSetBody() { $element = new Product(); $element->setSellerSku('ASM_A8012'); $collection = new ProductCollection(); $collection->add($element); $body = new Body(); $body->setProducts($collection); $response = new Response(); $response->setBody($body); $this->assertEquals('ASM_A8012', $response->getBody()->getProducts()->first()->getSellerSku()); }
public function testSerialization() { $element1 = new Product(); $element1->setSellerSku('MOB_12543'); $element2 = new Product(); $element2->setSellerSku('ASM_A8012'); $collection = new ProductCollection(); $collection->add($element1); $collection->add($element2); \SellerCenter\SDK\Common\AnnotationRegistry::registerAutoloadNamespace(); $serializer = \JMS\Serializer\SerializerBuilder::create()->build(); $xml = ' <Request> <Product> <SellerSku>MOB_12543</SellerSku> </Product> <Product> <SellerSku>ASM_A8012</SellerSku> </Product> </Request> '; $this->assertXmlStringEqualsXmlString($xml, $serializer->serialize($collection, 'xml')); }
public function testSerialization() { \SellerCenter\SDK\Common\AnnotationRegistry::registerAutoloadNamespace(); $serializer = \JMS\Serializer\SerializerBuilder::create()->build(); $product = new Product(); $product->setSellerSku('ASM_A8012'); $xml = '<Product><SellerSku>ASM_A8012</SellerSku></Product>'; $this->assertXmlStringEqualsXmlString($xml, $serializer->serialize($product, 'xml')); }