/**
  * Test update stock with a no product.
  */
 public function testUpdateStockNoProduct()
 {
     $objectManager = $this->prophesize('Doctrine\\Common\\Persistence\\ObjectManager');
     $productStockUpdater = new ProductStockUpdater($objectManager->reveal());
     $this->assertFalse($productStockUpdater->updateStock($this->prophesize('Elcodi\\Component\\Product\\Entity\\Interfaces\\PurchasableInterface')->reveal(), 0, false));
     $this->assertFalse($productStockUpdater->updateStock($this->prophesize('Elcodi\\Component\\Product\\Entity\\Interfaces\\VariantInterface')->reveal(), 0, false));
 }
 /**
  * Test update stock.
  *
  * @dataProvider dataUpdateStock
  */
 public function testUpdateStock($actualStock, $stockToDecrease, $newStock, $flush, $result)
 {
     $product = $this->prophesize('Elcodi\\Component\\Product\\Entity\\Interfaces\\ProductInterface');
     $product->getStock()->willReturn($actualStock);
     if (!is_null($newStock)) {
         $product->setStock($newStock)->shouldBeCalled();
     }
     $product = $product->reveal();
     $objectManager = $this->prophesize('Doctrine\\Common\\Persistence\\ObjectManager');
     if ($flush) {
         $objectManager->flush(Argument::any());
     }
     $productStockUpdater = new ProductStockUpdater($objectManager->reveal());
     $this->assertEquals($result, $productStockUpdater->updateStock($product, $stockToDecrease));
     $purchasableStockUpdater = new PurchasableStockUpdater();
     $purchasableStockUpdater->addPurchasableStockUpdater($productStockUpdater);
     $this->assertEquals($result, $purchasableStockUpdater->updateStock($product, $stockToDecrease));
 }