public function testCreateProductListingWithValidParameters() { $productListing = new ProductListing($this->priceministerClient, $this->client); $productListing->setParameter('kw', 121518297); $productListing->request(); }
public function testGetAllOffersOfAValidResponse() { $fixtures = file_get_contents(__DIR__ . '/fixtures/listing_ssl_ws_refproduct.xml'); $response = new Response(200, [], $fixtures); $mock = new MockHandler([$response]); $handler = HandlerStack::create($mock); $this->client = new Client(['handler' => $handler]); $productListing = new ProductListing($this->priceministerClient, $this->client); $productListing->setParameter('kw', 121518297); $productListing->setParameter('scope', 'PRICING'); $result = $productListing->request(); $offers = [['price' => 15.5, 'shippingcost' => 4.6, 'seller' => 'Topslibris', 'sellertype' => 'PRO', 'quality' => 'NEW']]; $this->assertEquals($offers, $result->getOffers()); }