/** * @param \SimpleXMLElement $xmlElement * @return \BolOpenApi\Response\ProductResponse * @throws \BolOpenApi\Exception */ public function createProductResponse(\SimpleXMLElement $xmlElement) { if ($xmlElement->getName() != 'ProductResponse') { throw new Exception('Invalid XML element, expected ProductResponse but got "' . $xmlElement->getName() . '"'); } $productResponse = new ProductResponse(); $productResponse->setSessionId((string) $xmlElement->SessionId); $productResponse->setProduct($this->modelFactory->createProduct($xmlElement->Product)); return $productResponse; }
public function testIsValid() { $this->assertTrue($this->productResponse->getProduct() instanceof \BolOpenApi\Model\Product); $this->assertEquals($this->productResponse->getProduct()->getId(), '1001004006016448'); $this->assertEquals($this->productResponse->getSessionId(), '492616E7-4B57-42A8-A688-28DD6943AE4E'); }