Example #1
0
 /**
  * @depends testAcessoAListaDeSkus
  */
 public function testAtualizaPrecoDoSkuInformado(Collection $data)
 {
     foreach ($data->getSkus() as $sku) {
         $client = $this->factoryClient();
         $response = $client->get('/sku/' . $sku['id']);
         $info = $response->getData()->getPrice();
         $price = Factory::factoryPrice($info);
         $this->assertEquals($info['sellPrice'], $price->getSellPrice());
         $newSellPrice = number_format($info['sellPrice'] * 0.99, 2, '.', '');
         $price->setSellPrice($newSellPrice);
         $this->assertEquals($newSellPrice, $price->getSellPrice());
         $changeData = $client->put('/sku/' . $sku['id'] . '/price', $price->toJson());
         $this->assertEquals(200, $changeData->getHttpStatusCode());
         $newResponse = $client->get('/sku/' . $sku['id']);
         $newPrice = Factory::factoryPrice($newResponse->getData()->getPrice());
         $this->assertEquals($newSellPrice, $newPrice->getSellPrice());
     }
 }