Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReservationPlacingOnCanSubtractQtySetToZeroTest.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
15 use PHPUnit\Framework\TestCase;
16 
18 {
22  private $appendReservations;
23 
27  private $reservationBuilder;
28 
32  private $getReservationQuantity;
33 
34  protected function setUp()
35  {
36  $this->appendReservations = Bootstrap::getObjectManager()->get(AppendReservationsInterface::class);
37  $this->reservationBuilder = Bootstrap::getObjectManager()->get(ReservationBuilderInterface::class);
38  $this->getReservationQuantity = Bootstrap::getObjectManager()->get(GetReservationsQuantityInterface::class);
39  }
40 
44  protected function tearDown()
45  {
46  Bootstrap::getObjectManager()->get(CleanupReservationsInterface::class)->execute();
47  }
48 
63  {
64  $this->appendReservations->execute(
65  [
66  $this->reservationBuilder->setStockId(10)->setSku('SKU-1')->setQuantity(2)->build()
67  ]
68  );
69 
70  self::assertEquals(0, $this->getReservationQuantity->execute('SKU-1', 10));
71  }
72 }